|
Post by TAZO on Dec 22, 2018 1:13:33 GMT
Where should I write the code to call Unit skill animation?
I mean use trigger via Animator of charater
I insert the code of walk animation in IEnumerator Traverse of WalkMovement.cs
Is it a reasonable way??
public override IEnumerator Traverse (Tile tile)
{
unit.Place(tile);
// Build a list of way points from the unit's
// starting tile to the destination tile
List<Tile> targets = new List<Tile>();
while (tile != null)
{
targets.Insert(0, tile);
tile = tile.prev;
}
// Move to each way point in succession
for (int i = 1; i < targets.Count; ++i)
{
Tile from = targets[i-1];
Tile to = targets;
Directions dir = from.GetDirection(to);
if (unit.dir != dir)
yield return StartCoroutine(Turn(dir));
if (from.height == to.height) {
unit.GetComponentInChildren<Animator> ().SetTrigger ("run");
yield return StartCoroutine (Walk (to));
} else {
unit.GetComponentInChildren<Animator> ().SetTrigger ("jump");
yield return StartCoroutine (Jump (to));
}
}
unit.GetComponentInChildren<Animator> ().SetTrigger ("idle");
yield return null;
}
|
|
tazo
New Member
Posts: 2
|
Post by tazo on Dec 22, 2018 2:24:37 GMT
OH! I find there is a good place. I write in PerformAbilityState.cs >>IEnumerator Animate (); Is this a good plan??
|
|
tazo
New Member
Posts: 2
|
Post by tazo on Dec 23, 2018 4:46:11 GMT
But...Where is the right place to insert the code of "die" animation...
|
|
|
Post by Admin on Dec 26, 2018 15:21:19 GMT
Look in the KnockOutStatusEffect script. When the component has OnEnable() or OnDisable() invoked it will set the localScale of the unit it is attached to. This could easily be changed to setting an Animator property.
|
|