protected void SetMotionAndDurationAndUseHPSP(AAnimal myself) { myself.UseHPSP(HPCost, SPCost, HPPercentCost, SPPercentCost); myself.GetAnimator().SetInteger("ActionCode", actioncode); myself.StartCoroutine(myself.DoingAction(duration)); }
public override void Action(AAnimal myself) { duration = 0.0f; runRouteForReal = new Vector3[runStep]; spCost = 1 * runStep; float speed = 1.0f; if (myself.MovementSpeed * myself.MovementBurst == 0) { } else { speed = myself.MovementSpeed * myself.MovementBurst; } for (int i = 1; i <= runRouteForReal.Length; i++) { duration += runLength[i] / speed; runRouteForReal[i - 1] = runRouteForCalc[i]; } myself.POS = myself.nextPOS; myself.nextPOS = runRouteForReal[runStep - 1]; if (runRouteForReal.Length == 1) { iTween.MoveTo(myself.gameObject, iTween.Hash("position", runRouteForReal[0], "time", duration, "easetype", "linear")); } else { iTween.MoveTo(myself.gameObject, iTween.Hash("path", runRouteForReal, "time", duration, "easetype", "linear")); } myself.GetAnimator().SetFloat("Speed", speed); myself.GetAnimator().SetInteger("ActionCode", actioncode); myself.UseHPSP(HPCost, SPCost, HPPercentCost, SPPercentCost); myself.StartCoroutine(myself.DoingAction(duration)); }