public override void ResetData() { StopAllCoroutines(); animHandler.ResetParam(); moveHandler.SetDestination(homePlace, homePlace); waypointQueue.Clear(); SetPlace(homePlace); currentState = EState.Prepare; PrepareAtHome(); }
void SetNextPlace() { CurrentPlace = Util.RoundToVectorInt((Vector2)transform.position); Vector2Int nextPlace = CurrentPlace; if (reservDir != Direction.Empty && CheckDirectionPlace(reservDir, ref nextPlace)) { CurrentDir = reservDir; reservDir = Direction.Empty; moveHandler.SetDestination(CurrentPlace, nextPlace); animHandler.SetDirection(CurrentDir); } else if (CurrentDir != Direction.Empty && CheckDirectionPlace(CurrentDir, ref nextPlace)) { moveHandler.SetDestination(CurrentPlace, nextPlace); } else { CurrentDir = Direction.Empty; reservDir = Direction.Empty; //animHandler.StopAnimation(); } }
public void Init(Vector2Int homePlace, Vector2Int stageMin, Vector2Int stageMax, Ghost partner = null) { moveHandler = GetComponent <MoveHandler>(); animHandler = GetComponent <GhostAnimationHandler>(); moveHandler.Init(moveSpeed, SetNextPlace); moveHandler.SetDestination(homePlace, homePlace); this.partner = partner; this.homePlace = homePlace; this.stageMin = stageMin; this.stageMax = stageMax; currentState = EState.Prepare; SetPlace(homePlace); PrepareAtHome(); }