public IEnumerator StartNewFight(AbstractBeing argEntity, AbstractLivingBeing argFightableObject) { SetUpAnims(); bool complete = false; int finished = 0; int step = 0; var quicktime = argFightableObject.GameObject.RequireComponentAdd<Quicktime>(); theTarget = argEntity; gameObject.RequireComponentAdd<AutonomousVehicle>(); predSteer = gameObject.RequireComponentAdd<SteerForPursuit>(); predSteer.Quarry = argEntity.gameObject.RequireComponentAdd<AutonomousVehicle>(); predSteer.enabled = true; ////debug.log("Enable chase"); while (complete == false) { // Remove Energy if Failed //if (finished == 3) //Ghost.Animation.Blend(AnimationResources.PossWrongInput); // Fail Entirely only if No EnergyLeft); if (MainPlayerGhost.Instance.Energy <= 0) { complete = true; argEntity.Animation.Stop(); argEntity.Animation.CrossFade(AnimationResources.Death); AbstractAnimal abAnimal = argEntity as AbstractAnimal; abAnimal._isDead = 1; abAnimal.AnimalSoundtrack.playDeath(); StartCoroutine(MainPlayerGhost.Instance.PossessionRemote.TurnOff(argEntity)); } // If Not Complete Run Quicktime Event if (!complete) { if (predSteer.enabled == false) { switch (step) { case 0: argFightableObject.Animation.CrossFade(AnimationResources.AttackDance); argEntity.Animation.CrossFade(AnimationResources.Freeze); break; } step++; yield return StartCoroutine(quicktime.Fire()); finished = quicktime.Status; if (finished == 2 && step != 0) { dodgeOrHit = 0; totalWins++; argFightableObject.Animation.Stop(); argFightableObject.Animation.Play(AnimationResources.Attack); AbstractAnimal abAnimal = argFightableObject as AbstractAnimal; abAnimal.AnimalSoundtrack.playBattle(); } else if (finished == 3 && step != 0) { dodgeOrHit = 1; argFightableObject.Animation.Stop(); argFightableObject.Animation.Play(AnimationResources.Attack); AbstractAnimal abAnimal = argFightableObject as AbstractAnimal; abAnimal.AnimalSoundtrack.playBattle(); } argFightableObject.Animation.CrossFadeQueued(AnimationResources.AttackDance); if (totalWins >= winsNeededToEscape) { complete = true; timeUntilActive = Time.time + restTime; argEntity.EnablePlayerControl(); SteerForPursuit steer = this.gameObject.GetComponent<SteerForPursuit>(); quicktime.Stop(); steer.enabled = false; totalWins = 0; fightIsOn = 0; } } else { yield return new WaitForFixedUpdate(); } } } yield return new WaitForFixedUpdate(); }