improved/new invisibility shader, added auto targetting to magic attacks usage

This commit is contained in:
2025-03-24 10:26:18 +01:00
parent 96e5f2b08d
commit d4906fa2b8
7 changed files with 1819 additions and 1439 deletions

View File

@@ -13,11 +13,13 @@ Material:
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- USEDISSOLVE_WITHOUT_ALPHA_CUTOUT
- USEDISSOLVE_WITH_ALPHA_CUTOUT
- USEFRESNEL
- _ALPHATEST_ON
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords:
- _RECEIVE_SHADOWS_OFF
- _SPECULAR_SETUP
- _USEDISSOLVE_WITHOUT_ALPHA_CUTOUT
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
@@ -33,7 +35,7 @@ Material:
serializedVersion: 3
m_TexEnvs:
- BaseTex:
m_Texture: {fileID: 2800000, guid: 55d97f02382f8664a948d4481e42ecc2, type: 3}
m_Texture: {fileID: 2800000, guid: 5c9ed9864385d8449b9f9528d61e1645, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- DissolveMask:
@@ -119,10 +121,10 @@ Material:
- Metalness: 0.26
- NormalStrength: 1.47
- Smoothness: 0.19
- USEDISSOLVE: 1
- USEDISSOLVE: 2
- USEDISSOLVEMASK: 0
- USEFRESNEL: 1
- Vector1_473704f964214ae2bc68475022d1524b: 0.088
- Vector1_473704f964214ae2bc68475022d1524b: 0.0432
- _AOStrength: 1.1
- _AlphaClip: 1
- _AlphaClipThreshold: 0.51
@@ -156,13 +158,13 @@ Material:
- _InverseFadeRange: 1
- _InverseFarFadeRange: 0.5
- _Metallic: 0
- _NormalStrength: 2.04
- _NormalStrength: 0.545
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueControl: 0
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 2.44
- _ReceiveShadows: 0
- _Smoothness: 2.27
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
@@ -173,7 +175,7 @@ Material:
- _USEDISTANCEFADE: 0
- _USESCANWAVE: 0
- _WaveTrail: 4
- _WorkflowMode: 1
- _WorkflowMode: 0
- _ZTest: 4
- _ZWrite: 1
- _ZWriteControl: 1
@@ -183,12 +185,12 @@ Material:
- Color_613d1588816440ec9b17710effb7528b: {r: 0, g: 0.46757713, b: 2.6082387,
a: 0}
- EmissiveColor: {r: 0, g: 0, b: 0, a: 0}
- _AdditionalColor: {r: 4.597549, g: 0.36867145, b: 0.5674405, a: 0}
- _AdditionalColor: {r: 95.87453, g: 7.6880527, b: 11.833063, a: 0}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BendVector: {r: 0, g: -1, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FresnelColor: {r: 2.7547174, g: 0.051819082, b: 0, a: 0}
- _FresnelColor: {r: 0.68867934, g: 0.012954771, b: 0, a: 0}
- _ScanWaveColor: {r: 0, g: 0.5949242, b: 1, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _UVMul: {r: 0.01, g: 0.04, b: 0, a: 0}

View File

@@ -106505,6 +106505,9 @@ MonoBehaviour:
animClipName: MagicPush
m_selectedType: 1
currentSelectedSpellName:
maxTurnTowardDistance: 10
rotationSpeed: 500
degreeThreshold: 100
actionInput:
useInput: 1
isAxisInUse: 0

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,7 @@ using UnityEngine.Events;
using UnityEngine.VFX;
using static Invector.vObjectDamage;
using DG.Tweening;
using Invector.vCharacterController.AI.FSMBehaviour;
namespace Beyond
{
@@ -61,6 +62,15 @@ namespace Beyond
private ShieldCollisionController shieldCollisionController;
private bool canPlayNoFaithClip = true;
private bool canPlayCantDoClip = true;
[BoxGroup("Auto targetting")]
public float maxTurnTowardDistance = 10f;
[BoxGroup("Auto targetting")]
public float rotationSpeed = 500f;
[BoxGroup("Auto targetting")]
public float degreeThreshold = 100;
public UnityAction<Collider> onHitFireball;
@@ -191,7 +201,8 @@ namespace Beyond
private IEnumerator FlameThrowerhCoroutine()
{
EffectDesc flameThrowe = m_effects[(int)EffectType.FLAME_THROWER];
yield return new WaitForSeconds(flameThrowe.startTime);
//yield return new WaitForSeconds(flameThrowe.startTime);
yield return TurnTowardTargetCoroutine(flameThrowe.startTime);
flameDamager.enabled = true;
flame.Play();
yield return new WaitForSeconds(flameThrowe.endTime);
@@ -246,10 +257,21 @@ namespace Beyond
StartCoroutine(FireballCoroutine());
}
private IEnumerator TurnTowardTargetCoroutine(float maxTime)
{
float time = 0;
while (time < maxTime)
{
time += Time.deltaTime;
LerpRotation();
yield return null;
}
yield return null; }
private IEnumerator FireballCoroutine()
{
EffectDesc fireball = m_effects[(int)EffectType.FIREBALL];
yield return new WaitForSeconds(fireball.startTime);
//yield return new WaitForSeconds(fireball.startTime);
yield return TurnTowardTargetCoroutine(fireball.startTime);
var fireballClone = Instantiate(fireball.effectObject, fireball.effectObject.transform.position, fireball.effectObject.transform.rotation);
fireballClone.SetActive(true);
RFX4_PhysicsMotion fireballMotionController = fireballClone.GetComponentInChildren<RFX4_PhysicsMotion>(); //could maybe add some reference container to use get component without children
@@ -478,6 +500,72 @@ namespace Beyond
selectedEffect = GetCurrentlySelectedPower();
}
private void LerpRotation()
{
float minDist = maxTurnTowardDistance;
var enemy = GetNearestEnemy(ref minDist);
if (!IsEnemyInAngleRange(enemy))
{
return;
}
Transform playerTransform = Player.Instance.transform;
var toEnemy = enemy.transform.position - playerTransform.position;
toEnemy.y = 0f;
toEnemy.Normalize();
Quaternion targetRot =
Quaternion.LookRotation(toEnemy);
var rotation = playerTransform.rotation;
rotation = Quaternion.RotateTowards(rotation, targetRot, Time.deltaTime * rotationSpeed);
//rotation = Quaternion.Lerp(rotation, targetRot, Time.deltaTime * rotationSpeed);
playerTransform.rotation = rotation;
}
private bool IsEnemyInAngleRange(vFSMBehaviourController ai)
{
if (ai == null)
{
return false;
}
Vector3 playerFwd = Player.Instance.transform.forward;
Vector3 target = (ai.transform.forward - playerFwd).normalized;
float dot = Vector3.Dot(playerFwd, target );
float angle = 180f - Mathf.Acos(dot) * Mathf.Rad2Deg;
//Debug.Log("IsEnemyInAngleRange: angle: "+angle);
if (angle > degreeThreshold)
{
return false;
}
return true;
}
private vFSMBehaviourController GetNearestEnemy(ref float minDist)
{
var controllers = GameStateManager.Instance.GetActiveCombatcontrollers();
Vector3 playerPos = Player.Instance.transform.position;
vFSMBehaviourController ctrl = null;
foreach (var aic in controllers)
{
var dist2 = aic.transform.position - Player.Instance.transform.position;
dist2.y = 0f;
if (dist2.magnitude < minDist)
{
ctrl = aic;
minDist = dist2.magnitude;
}
}
return ctrl;
}
protected virtual void AnimationBehaviour()
{ // know if the animation is playing or not

View File

@@ -220,6 +220,7 @@
"m_OutputNode": {
"m_Id": "35580cbe7e324ac9b5a2d95328e64725"
},
"m_SubDatas": [],
"m_ActiveTargets": []
}
@@ -321,6 +322,7 @@
],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
@@ -353,6 +355,7 @@
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
@@ -420,6 +423,7 @@
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
@@ -486,6 +490,7 @@
],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
@@ -538,6 +543,7 @@
],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
@@ -570,6 +576,7 @@
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
@@ -583,8 +590,8 @@
"m_ObjectId": "484016ef888d4dd7a1c939b5fbcaf0e5",
"m_Title": "Distortion",
"m_Position": {
"x": -1894.5008544921875,
"y": -814.9999389648438
"x": -999.0000610351563,
"y": -576.0
}
}
@@ -648,6 +655,7 @@
],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
@@ -692,6 +700,7 @@
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
@@ -709,7 +718,7 @@
"m_ShaderOutputName": "B",
"m_StageCapability": 3,
"m_Value": {
"e00": 0.009999999776482582,
"e00": 0.03999999910593033,
"e01": 2.0,
"e02": 2.0,
"e03": 2.0,
@@ -844,7 +853,7 @@
"m_ShaderOutputName": "B",
"m_StageCapability": 3,
"m_Value": {
"e00": 0.10000000149011612,
"e00": 0.05000000074505806,
"e01": 2.0,
"e02": 2.0,
"e03": 2.0,
@@ -915,7 +924,7 @@
"m_Hidden": false,
"m_ShaderOutputName": "Scale",
"m_StageCapability": 3,
"m_Value": 25.0,
"m_Value": 8.300000190734864,
"m_DefaultValue": 10.0,
"m_Labels": []
}
@@ -1052,6 +1061,7 @@
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
@@ -1205,6 +1215,7 @@
],
"m_Precision": 1,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 2,
"m_CustomColors": {
"m_SerializableColors": []
@@ -1302,7 +1313,7 @@
}
{
"m_SGVersion": 0,
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.GradientNoiseNode",
"m_ObjectId": "ddce5c911d1a4545ab2913a885087044",
"m_Group": {
@@ -1335,10 +1346,12 @@
],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
}
},
"m_HashType": 0
}
{

View File

@@ -31,6 +31,10 @@ Material:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- BaseTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
@@ -106,6 +110,7 @@ Material:
- _AlphaClipThreshold: 0.5
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _CastShadows: 1
- _ClearCoatMask: 0

File diff suppressed because it is too large Load Diff