protected IEnumerator SpecialAttackTimer() { ultStartedTime = Time.time; yield return(new WaitForSeconds(specialAttackTimer)); currentSpecialAttack = Nothing; }
protected virtual void Start() { currentMovement = MoveTank; currentRotationMethod = RotateTank; specialAttackMethods = new SpecialAttackMethod[] { FireMissile, SpawnShield, SpeedBoost, Heal, SuperHeal, DeployMine, SuperShots }; currentSpecialAttack = Nothing; directSliderTF = healthSlider.gameObject.GetComponentInParent <Transform>(); delayedSliderTF = healthSliderDelayed.gameObject.GetComponentInParent <Transform>(); InitializeStats(); }
/// <summary> /// Create a ship based on this description. /// </summary> /// <param name="level">The level that will contain this Ship.</param> /// <param name="description">The ship description details.</param> public Ship(GamePlay level, ShipDescription description) : this(level, description.TexturePath, description.ParticleColor, description.ParticleDuration, description.NormalAmmo, description.SpecialAmmo) { Mass = description.Mass; MaxSpeed = description.MaxSpeed; RotationStabilizer = description.RotationStabilizer; SpecialAttack = description.SpecialAttack.Special; var fuel = (int)description.FuelDuration.TotalMilliseconds; var minReserve = (int)FuelReserve.TotalMilliseconds; Fuel = new AutoRegenContainer(fuel, FuelRegenTime) { Reserve = Math.Max((int)(fuel * 0.5f), minReserve) }; }
protected bool ShouldUltimate(SpecialAttackMethod currentUlt) { if (currentUlt == null || currentUlt == Nothing) //Not allowed to use switch on delegate methods :c ugly code it is! { return(false); } else if (Time.time > ultStartedTime + specialAttackTimer - 1) { return(true); } else if (currentUlt == SuperHeal || currentUlt == Heal) { if (health <= (maxHealth / 3) * 4) { return(true); } return(false); } else if (currentUlt == SuperShots || currentUlt == SpawnShield) { RaycastHit hit; if (Physics.Raycast(shotStart.transform.position, (target.transform.position - shotStart.transform.position), out hit)) { if (hit.transform.GetComponent <PlayerScript>() != null) { return(true); } } return(false); } else if (currentUlt == DeployMine) { if (Vector3.Distance(transform.position, agent.destination) < 10f) { return(true); } return(false); } return(true); }
protected IEnumerator SpinWheel() { if (!alive) { StopCoroutine("SpinWheel"); } spinning = true; if (this is PlayerScript) { UIManager.Instance.SpinWheel(); } yield return(new WaitForSeconds(spinTime)); spinning = false; specialAttackIndex = forceSpecialAttack ? forcedSpecialIndex : Random.Range(0, specialAttackMethods.Length); StartCoroutine("SpecialAttackTimer"); currentSpecialAttack = specialAttackMethods[specialAttackIndex]; if (this is PlayerScript) { UIManager.Instance.SpecialAttack(true, specialAttackTimer, specialAttackIndex); } }