public void StartSpecial() { SpecialAttackController special = rsc.poolMng.player1SpecialAttackPool.GetObject(); if (special != null) { special.transform.position = transform.position; } }
public override void AddToGame(IGame game) { EntityController entityController = Service.Get <EntityController>(); this.buffNodeList = entityController.GetNodeList <BuffNode>(); this.troopNodeList = entityController.GetNodeList <TroopNode>(); this.turretNodeList = entityController.GetNodeList <TurretNode>(); this.troopAttackController = Service.Get <TroopAttackController>(); this.specialAttackController = Service.Get <SpecialAttackController>(); this.turretAttackController = Service.Get <TurretAttackController>(); }
public override void AddToGame(Game game) { this.entityController = Service.EntityController; this.battleController = Service.BattleController; this.troopAbilityController = Service.TroopAbilityController; this.audioManager = Service.AudioManager; this.specialAttackController = Service.SpecialAttackController; this.squadTroopAttackController = Service.SquadTroopAttackController; this.buildingNodeList = this.entityController.GetNodeList <BuildingNode>(); this.troopNodeList = this.entityController.GetNodeList <TroopNode>(); this.audioResetDeltaMax = ((!HardwareProfile.IsLowEndDevice()) ? 33u : 330u); this.audioResetDeltaAccumulator = this.audioResetDeltaMax; }
void FixedUpdate() { Vector2 direction = Vector2Utils.Vector2FromAngle(Rigidbody.rotation); if (DesiredMovement > 0) { // Set drag to give the ship a terminal velocity Rigidbody.drag = MovementDrag; Rigidbody.AddForce( DesiredMovement * AccelerationFactor * Time.deltaTime * BaseAcceleration * direction ); if (AccelerationFactor > 0 && TailParticleSystem.isStopped) { TailParticleSystem.Play(); } } else { Rigidbody.drag = 0; if (TailParticleSystem.isPlaying) { TailParticleSystem.Stop(); } } Rigidbody.AddTorque( BaseTorque * Time.deltaTime * DesiredRotation * TorqueFactor ); if (DesiredRotation != 0 && TorqueFactor > 0) { if (DesiredRotation > 0) { if (LeftParticleSystem.isStopped) { LeftParticleSystem.Play(); } if (RightParticleSystem.isPlaying) { RightParticleSystem.Stop(); } } else { if (RightParticleSystem.isStopped) { RightParticleSystem.Play(); } if (LeftParticleSystem.isPlaying) { LeftParticleSystem.Stop(); } } } else { if (LeftParticleSystem.isPlaying) { LeftParticleSystem.Stop(); } if (RightParticleSystem.isPlaying) { RightParticleSystem.Stop(); } } ShotCooldown -= Time.deltaTime; if (ShotCooldown <= 0 && Shoot && ShootFactor > 0f) { if (BlasterParts[0].activeSelf) { foreach (var cannon in CannonControllersLevel1) { cannon.Fire(direction, Rigidbody.velocity); } } if (BlasterParts[1].activeSelf) { foreach (var cannon in CannonControllersLevel2) { cannon.Fire(direction, Rigidbody.velocity); } } if (BlasterParts[2].activeSelf) { foreach (var cannon in CannonControllersLevel3) { cannon.Fire(direction, Rigidbody.velocity); } } Rigidbody.AddForce(BaseRecoil * Mathf.Exp(ShootFactor) * direction); Shake(); ShotCooldown = ShotCooldownTime; } UpdateSpecialAttackTimer(SpecialAttackTimer + Time.deltaTime); if (SpecialAttackTimer >= MaxSpecialAttackTimer) { if (ExecuteSpecialAttack) { SpecialAttackController specialAttackController = Instantiate(SpecialAttack, transform.position, transform.rotation, transform.parent).GetComponent <SpecialAttackController>(); specialAttackController.Fire(gameObject, WorldController); Shake(SpecialAttackController.Duration); WorldController.Flash(2); UpdateSpecialAttackTimer(0f); } } UpdateCameraZoom(Rigidbody.velocity.magnitude); }