private void SetDirection() { switch (currentState) { case UnitState.PathWalk: SpeedToDirection(); fighterAnimController.ChangeAnim("Walk"); if (hasShadow) { shadowAnimController.ChangeAnim("Walk_Shadow"); } break; case UnitState.Attack: SetRelativeDirection(); fighterAnimController.ChangeAnim("Attack"); if (hasShadow) { shadowAnimController.ChangeAnim("Attack_Shadow"); } break; case UnitState.Idle: //SetRelativeDirection(); fighterAnimController.ChangeAnim("Idle"); if (hasShadow) { shadowAnimController.ChangeAnim("Idle_Shadow"); } break; } fighterAnimController.Turn(direction); fighterAnimController.UpdateCharacterAnimation(); if (hasShadow) { switch (currentState) { case UnitState.PathWalk: shadowAnimController.ChangeAnim("Walk_Shadow"); break; case UnitState.Attack: shadowAnimController.ChangeAnim("Attack_Shadow"); break; case UnitState.Idle: shadowAnimController.ChangeAnim("Idle_Shadow"); break; } shadowAnimController.Turn(direction); shadowAnimController.UpdateCharacterAnimation(); } }
private void ChangeAnimation(string action) { string direction = " "; switch (action) { case "Walk": switch (curPathIndex) { case 0: direction = "SW"; break; case 1: direction = "NW"; break; case 2: direction = "NE"; break; case 3: direction = "SE"; break; } break; case "Plow": switch (curPathIndex) { case 0: direction = "N"; break; case 1: direction = "E"; break; case 2: direction = "S"; break; case 3: direction = "W"; break; } break; case "Seed": switch (curPathIndex) { case 0: direction = "N"; break; case 1: direction = "E"; break; case 2: direction = "S"; break; case 3: direction = "W"; break; } break; } //break; //} dobbitAnimController.ChangeAnim(action); dobbitAnimController.Turn(direction); dobbitAnimController.UpdateCharacterAnimation(); }