Beispiel #1
0
    private void _shootTarget(BaseUnitState target)
    {
        var shootEvent = new Events.TurretAttackEvent(State.Id, target.Id, BalanceConsts.TurretDamage);

        Game.PushEvent(shootEvent);

        var pos       = target.Position + M.RadialSpread() * PhysicsConsts.SoldierRadius * 1.5f;
        var explosion = new Events.ExplosionEvent(pos, BalanceConsts.TurretSplashDamage,
                                                  BalanceConsts.TurretSplashRadius, 1.0f, State.LaneKey, State.Side);

        Game.PushEvent(explosion);
        State.ShootCooldown = BalanceConsts.TurretAttackCooldown;
        State.TargetId      = target.Id;
    }
Beispiel #2
0
    private void _die()
    {
        Game.PushEvent(new Events.TurretDieEvent(State.Id));
        Destroy(gameObject);

        var offset = State.Side == Side.Player ? 80.0f : -80f;

        F.Map(v =>
        {
            var pos       = State.Position + M.RadialSpread() * 60.0f + Vector2.up * v * offset;
            var explosion = new Events.ExplosionEvent(pos, BalanceConsts.TurretSplashDamage,
                                                      BalanceConsts.TurretSplashRadius, 1.0f, State.LaneKey, State.Side);
            var fireDelay            = v * 0.3f;
            explosion.EventFireDelay = fireDelay;
            Game.PushEvent(explosion);
            var sound = new Events.PlaySoundEvent(SoundType.TurretShoot, fireDelay);
            Game.PushEvent(sound);
            Game.PushEvent(new Events.CheckGameEndEvent());
            return(0);
        }, F.Range(0, 3));
    }