private bool _hitSomething = false; //!indicates if we have hit a player or not //! Use this for initialization void Start() { Trajectory = Path; LifeTimer = new X8Timer(LifeLimit); LifeTimer.TurnTimerOn(); //get the timer that is attached to this object }
//when the player is shoot with a bullet the sheilds go doen // void OnCollisionStay(Collision Entity) void DecreaseShield() { shieldPercentage -= 5; //decrement the shields when the shield are hit if (shieldPercentage < 0) { shieldPercentage = 0; //make sure we stay in the bounds of the number we want } if (shieldPercentage > 100) { shieldPercentage = 100; //make sure we stay in the bounds of the number we want } ShieldTimer.Reset(); //reset the time to ShieldTimer.TurnTimerOn(); //turn the timer back on }
void EnemyAI_Attack() { if (EnemyAI.attackState == Ai.ATTACK_STATE.CanAttackPlayer) { if (TackleTimer.IsEnabled == false) { TackleTimer.TurnTimerOn(); } if (PlayerTackleState == TackleState.IsNotTackling) { if (TackleTimer.AgeinSeconds < Time.deltaTime) //if the timer has been on for no more than one frame this simulates a button press { // Debug.Log("legomania"); X8Animator.SetFloat("Speed", 0f); X8Animator.SetBool("Tackle", true); } } } }
/*! Enables the charger */ public void EnableCharger()// { ChargeTimer.TurnTimerOn(); }
// Update is called once per frame void Update() { AnimatorStateInfo Layer1State = X8Animator.GetCurrentAnimatorStateInfo(1); for (int i = 0; i < Bolts.Count; ++i) { if (Bolts[i].IsTicking == false) //if the timer is off and hence beyond its age limit { RaydraProjectile CurrentBolt = Bolts[i]; //get the instance Bolts.RemoveAt(i); Destroy(CurrentBolt.gameObject); } else { Bolts[i].transform.position += Bolts[i].TravelPath; //move the projecti } } if (Input.GetButton("Shoot")) { if (X8Animator.GetBool("Shoot") == false) { X8Animator.SetBool("Shoot", true); } ChargeTimer.TurnTimerOn(); //turn on the charge timer ChargeTimer.Update(); } else { X8Animator.SetBool("Shoot", false); } if (Input.GetButtonUp("Shoot")) { //fire the weapon upon the release of the the button this.ShootWeapon(CameraFocus.transform.position - Camera.main.transform.position); if (WeaponCharged == true) //reset the the charged state of the weapon { WeaponCharged = false; } ChargeTimer.Reset(); //reset the charge time } if (Layer1State.IsName("Shoot")) { X8Animator.SetLayerWeight(1, 1);//increase the weigt of the layer with the shoot animation } else { /// ThePlayer.PlayerAttackState = AttackMode.NotFiringAbility; X8Animator.SetLayerWeight(1, 0); if (this.WeaponFired == true) { this.WeaponFired = false; } } }
//! this medthod will turn the timer on public void TurnTimerOn() { LifeTimer.TurnTimerOn(); }
/*!Called when the timer limit is reached*/ public void FireShootTimer() { ShootTimer.TurnTimerOn(); ShootTimer.IncrementTimer(); }