阶段性完成
This commit is contained in:
@@ -45,6 +45,11 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (owner.statusSm.isDead)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fullBodyFuncAnimSm?.UpdateTime();
|
||||
UpdateIntervalInfo();
|
||||
}
|
||||
@@ -78,7 +83,20 @@ namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
public virtual void RegisterDefaultFunctions()
|
||||
{
|
||||
registeredFunctions.Add("SetRootMotionMoveXMultiplier", anim =>
|
||||
{
|
||||
owner.movementSc.rootMotionMoveXMultiplier = anim.runtimeVariables.GetVariable<float>("RootMotionMoveXMultiplier");
|
||||
});
|
||||
|
||||
registeredFunctions.Add("SetRootMotionMoveYMultiplier", anim =>
|
||||
{
|
||||
owner.movementSc.rootMotionMoveYMultiplier = anim.runtimeVariables.GetVariable<float>("SetRootMotionMoveYMultiplier");
|
||||
});
|
||||
|
||||
registeredFunctions.Add("SetRootMotionMoveZMultiplier", anim =>
|
||||
{
|
||||
owner.movementSc.rootMotionMoveZMultiplier = anim.runtimeVariables.GetVariable<float>("SetRootMotionMoveZMultiplier");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +104,7 @@ namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
public virtual bool SetGetHitDisruption(DisruptionType disruptionType, BreakthroughType breakthroughType)
|
||||
{
|
||||
if (owner.reactionSc.breakthroughResistances[breakthroughType].value)
|
||||
if (owner.reactionSc.breakthroughResistances[breakthroughType])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
public bool useCharacterController = true;
|
||||
public Collider MainCollider => useCharacterController ? characterController : mainCollider;
|
||||
|
||||
public List<Collider> hurtBoxes;
|
||||
|
||||
[ShowInInspector] [ShowIf("useCharacterController")]
|
||||
public CharacterController characterController;
|
||||
@@ -17,6 +19,8 @@ namespace Cielonos.MainGame.Characters
|
||||
[ShowInInspector] [HideIf("useCharacterController")]
|
||||
public Collider mainCollider;
|
||||
[ShowInInspector][HideIf("useCharacterController")]
|
||||
public float mainColliderRadius;
|
||||
[ShowInInspector][HideIf("useCharacterController")]
|
||||
public List<Collider> otherColliders;
|
||||
|
||||
[Button("Collect Colliders")]
|
||||
@@ -34,5 +38,19 @@ namespace Cielonos.MainGame.Characters
|
||||
if(mainCollider != null) otherColliders.Remove(mainCollider);
|
||||
}
|
||||
}
|
||||
|
||||
public void DisableAllColliders()
|
||||
{
|
||||
foreach (Collider col in hurtBoxes)
|
||||
{
|
||||
col.enabled = false;
|
||||
}
|
||||
|
||||
MainCollider.enabled = false;
|
||||
foreach (Collider col in otherColliders)
|
||||
{
|
||||
col.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,6 +101,10 @@ namespace Cielonos.MainGame.Characters
|
||||
Vector3 forceMove = owner.additionalForceSm.additionalForceXZ.currentValue * DeltaTime;
|
||||
|
||||
finalMovementVelocity = initiativeMovementVelocity + forceMove + jumpMove + gravitationalMovement;
|
||||
|
||||
|
||||
bool isHorizontalMoving = horizontalMovement.magnitude > 0.1f * DeltaTime;
|
||||
animator.SetBool(Animator.StringToHash("IsHorizontalMoving"), isHorizontalMoving);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,17 @@ namespace Cielonos.MainGame.Characters
|
||||
isApplyingGravity = true;
|
||||
|
||||
characterTransform = character.transform;
|
||||
groundDetector ??= new GroundDetector(owner, 0.1f, 0.1f, 0.05f, LayerMask.GetMask("Default", "Ground", "FadableEnvironment", "UnfadableEnvironment"));
|
||||
|
||||
if (owner is Player)
|
||||
{
|
||||
var groundMasks = LayerMask.GetMask("Default", "Enemy", "Wall", "Ground", "FadableEnvironment", "UnfadableEnvironment");
|
||||
groundDetector ??= new GroundDetector(owner, 0.1f, 0.1f, 0.05f, groundMasks);
|
||||
}
|
||||
else
|
||||
{
|
||||
groundDetector ??= new GroundDetector(owner, 0.1f, 0.1f, 0.05f,
|
||||
LayerMask.GetMask("Default", "Wall", "Ground", "FadableEnvironment", "UnfadableEnvironment"));
|
||||
}
|
||||
}
|
||||
|
||||
public void TurnToTarget(CharacterBase target, float duration = 0.2f)
|
||||
|
||||
@@ -103,9 +103,9 @@ namespace Cielonos.MainGame.Characters
|
||||
public float perfectTime;
|
||||
public float blockTime;
|
||||
public string perfectEffectName;
|
||||
public Action onPerfectBlock;
|
||||
public Action<AttackAreaBase> onPerfectBlock;
|
||||
public string normalEffectName;
|
||||
public Action onNormalBlock;
|
||||
public Action<AttackAreaBase> onNormalBlock;
|
||||
|
||||
public BlockSource(CharacterBase sourceCharacter, ItemBase sourceItem, string blockName,
|
||||
int priority, string blockEffectName, float blockTime)
|
||||
@@ -135,7 +135,7 @@ namespace Cielonos.MainGame.Characters
|
||||
this.normalEffectName = normalEffectName;
|
||||
}
|
||||
|
||||
public void PerfectBlock(Vector3 blockEffectPosition)
|
||||
public void PerfectBlock(AttackAreaBase attackArea, Vector3 blockEffectPosition)
|
||||
{
|
||||
if (sourceItem != null)
|
||||
{
|
||||
@@ -144,10 +144,10 @@ namespace Cielonos.MainGame.Characters
|
||||
sourceItem.blockData.InstantiateBlockEffect(perfectEffectName, blockEffectPosition, Quaternion.identity);
|
||||
}
|
||||
|
||||
onPerfectBlock?.Invoke();
|
||||
onPerfectBlock?.Invoke(attackArea);
|
||||
}
|
||||
|
||||
public void NormalBlock(Vector3 blockEffectPosition)
|
||||
public void NormalBlock(AttackAreaBase attackArea, Vector3 blockEffectPosition)
|
||||
{
|
||||
if (sourceItem != null)
|
||||
{
|
||||
@@ -156,7 +156,7 @@ namespace Cielonos.MainGame.Characters
|
||||
sourceItem.blockData.InstantiateBlockEffect(normalEffectName, blockEffectPosition, Quaternion.identity);
|
||||
}
|
||||
|
||||
onNormalBlock?.Invoke();
|
||||
onNormalBlock?.Invoke(attackArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,6 +145,7 @@ namespace Cielonos.MainGame.Characters
|
||||
if (sourceItem == null)
|
||||
{
|
||||
sourceCharacter.feedbackSc["PerfectDodge"].Play();
|
||||
Debug.Log("Perfect Dodge!");
|
||||
}
|
||||
|
||||
onPerfectDodge?.Invoke();
|
||||
|
||||
@@ -7,29 +7,58 @@ namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
public class ReactionSubcontroller : SubcontrollerBase<CharacterBase>
|
||||
{
|
||||
public Dictionary<BreakthroughType, CompoundVariable<bool>> breakthroughResistances;
|
||||
public Dictionary<BreakthroughType, bool> originalBreakthroughResistances;
|
||||
public Dictionary<BreakthroughType, bool> breakthroughResistances;
|
||||
public DodgeSubmodule dodgeSm;
|
||||
public BlockSubmodule blockSm;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
breakthroughResistances = new Dictionary<BreakthroughType, CompoundVariable<bool>>()
|
||||
|
||||
originalBreakthroughResistances = new Dictionary<BreakthroughType, bool>()
|
||||
{
|
||||
{ BreakthroughType.None, new CompoundVariable<bool>(true) },
|
||||
{ BreakthroughType.Weak, new CompoundVariable<bool>(true) },
|
||||
{ BreakthroughType.Medium, new CompoundVariable<bool>(true) },
|
||||
{ BreakthroughType.Heavy, new CompoundVariable<bool>(false) },
|
||||
{ BreakthroughType.SuperHeavy, new CompoundVariable<bool>(false) }
|
||||
{ BreakthroughType.None, true },
|
||||
{ BreakthroughType.Weak, true },
|
||||
{ BreakthroughType.Medium, true },
|
||||
{ BreakthroughType.Heavy, true },
|
||||
{ BreakthroughType.Disruption, false },
|
||||
{ BreakthroughType.Forced, false },
|
||||
{ BreakthroughType.Unstoppable, false },
|
||||
};
|
||||
|
||||
breakthroughResistances = new Dictionary<BreakthroughType, bool>()
|
||||
{
|
||||
{ BreakthroughType.None, true },
|
||||
{ BreakthroughType.Weak, true },
|
||||
{ BreakthroughType.Medium, true },
|
||||
{ BreakthroughType.Heavy, true },
|
||||
{ BreakthroughType.Disruption, false },
|
||||
{ BreakthroughType.Forced, false },
|
||||
{ BreakthroughType.Unstoppable, false },
|
||||
};
|
||||
|
||||
dodgeSm = new DodgeSubmodule(this);
|
||||
blockSm = new BlockSubmodule(this);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (owner.statusSm.isDead)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dodgeSm.Update();
|
||||
blockSm.Update();
|
||||
}
|
||||
|
||||
public void ResetBreakthroughResistances()
|
||||
{
|
||||
foreach (var kvp in originalBreakthroughResistances)
|
||||
{
|
||||
breakthroughResistances[kvp.Key] = kvp.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using Sirenix.OdinInspector;
|
||||
using TrailsFX;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
@@ -16,11 +17,12 @@ namespace Cielonos.MainGame.Characters
|
||||
public List<SkinnedMeshRenderer> baseRenderers;
|
||||
public List<Material> baseRenderMaterials;
|
||||
|
||||
public List<GameObject> effectContainers;
|
||||
public Dictionary<string, GameObject> effectContainers;
|
||||
[HideInEditorMode]
|
||||
public Dictionary<string, List<SkinnedMeshRenderer>> effectRenderers;
|
||||
[HideInEditorMode]
|
||||
public Dictionary<string, List<Material>> effectRenderMaterials;
|
||||
|
||||
public TrailEffect characterTrail;
|
||||
public List<TrailEffect> dashTrails;
|
||||
}
|
||||
|
||||
public partial class RenderSubcontrollerBase
|
||||
@@ -37,17 +39,10 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
effectRenderers = new Dictionary<string, List<SkinnedMeshRenderer>>();
|
||||
effectRenderMaterials = new Dictionary<string, List<Material>>();
|
||||
|
||||
for (int i = 0; i < effectContainers.Count; i++)
|
||||
|
||||
foreach (KeyValuePair<string, GameObject> container in effectContainers)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
effectRenderers["GetHitBlink"] = new List<SkinnedMeshRenderer>(effectContainers[i].GetComponentsInChildren<SkinnedMeshRenderer>());
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
effectRenderers["Outline"] = new List<SkinnedMeshRenderer>(effectContainers[i].GetComponentsInChildren<SkinnedMeshRenderer>());
|
||||
}
|
||||
effectRenderers[container.Key] = new List<SkinnedMeshRenderer>(container.Value.GetComponentsInChildren<SkinnedMeshRenderer>());
|
||||
}
|
||||
|
||||
foreach (var kvp in effectRenderers)
|
||||
@@ -141,7 +136,7 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
getHitBlinkTween.OnPlay(() =>
|
||||
{
|
||||
effectContainers[0].SetActive(true);
|
||||
effectContainers["GetHitBlink"].SetActive(true);
|
||||
});
|
||||
|
||||
foreach (Material mat in effectRenderMaterials["GetHitBlink"])
|
||||
@@ -161,7 +156,7 @@ namespace Cielonos.MainGame.Characters
|
||||
getHitBlinkTween.SetLoops(2, LoopType.Yoyo);
|
||||
getHitBlinkTween.OnComplete(() =>
|
||||
{
|
||||
effectContainers[0].SetActive(false);
|
||||
effectContainers["GetHitBlink"].SetActive(false);
|
||||
});
|
||||
|
||||
getHitBlinkTween.Play();
|
||||
@@ -173,7 +168,7 @@ namespace Cielonos.MainGame.Characters
|
||||
private Sequence outlineOnTween;
|
||||
private Sequence outlineOffTween;
|
||||
|
||||
public void OutlineOn(string type, float width, float fadeInDuration)
|
||||
public void OutlineOn(BreakthroughType type, float width, float fadeInDuration)
|
||||
{
|
||||
outlineOffTween?.Kill(true);
|
||||
outlineOnTween?.Kill(true);
|
||||
@@ -181,7 +176,7 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
outlineOnTween.OnPlay(() =>
|
||||
{
|
||||
effectContainers[1].SetActive(true);
|
||||
effectContainers["Outline"].SetActive(true);
|
||||
});
|
||||
|
||||
foreach (Material mat in effectRenderMaterials["Outline"])
|
||||
@@ -212,7 +207,7 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
outlineOffTween.OnComplete(() =>
|
||||
{
|
||||
effectContainers[1].SetActive(false);
|
||||
effectContainers["Outline"].SetActive(false);
|
||||
});
|
||||
|
||||
outlineOffTween.Play();
|
||||
|
||||
Reference in New Issue
Block a user