Esempio n. 1
0
    private void begin()
    {
        TimedCallbacks callbacks = this.GetComponent <TimedCallbacks>();

        callbacks.AddCallback(this, this.SpawnPlayers, this.SpawnPlayersDelay);
        callbacks.AddCallback(this, this.SpawnEnemies, this.SpawnEnemiesDelay);
    }
 private void triggerDeaths()
 {
     for (int i = 0; i < this.SubBosses.Count; ++i)
     {
         _timedCallbacks.AddCallback(this, killSubBoss, i * this.SubBossDeathSpacing);
     }
 }
 private void onDeath(int hp)
 {
     _dead = true;
     while (_minions.Count > 0)
     {
         _minions[_minions.Count - 1].Kill(0.0f);
     }
     for (int i = 0; i < this.SubBosses.Count; ++i)
     {
         this.SubBosses[i].GetComponent <LerpMovement>().HaltMovement();
     }
     for (int i = 0; i < this.MinionSpawners.Length; ++i)
     {
         Destroy(this.MinionSpawners[i].gameObject);
     }
     _timedCallbacks.AddCallback(this, triggerDeaths, this.DeathDelay);
     _timedCallbacks.AddCallback(this, this.EndFlowObject.GetComponent <WinCondition>().EndLevel, this.EndLevelDelay);
 }
Esempio n. 4
0
 private void onDeath()
 {
     Destroy(this.MinionSpawner.gameObject);
     _radius.Running = false;
     while (_minions.Count > 0)
     {
         _minions[_minions.Count - 1].Kill(0.0f);
     }
     _timedCallbacks.AddCallback(this, this.EndFlowObject.GetComponent <WinCondition>().EndLevel, this.DeathDelay);
 }
Esempio n. 5
0
 private void activeDialogChanged(UIDialog activeDialog)
 {
     if (activeDialog == this)
     {
         _timedCallbacks.RemoveCallbacksForOwner(this);
         _timedCallbacks.AddCallback(this, beginAcceptingInput, BEGIN_ACCEPTING_INPUT_DELAY);
     }
     else
     {
         _timedCallbacks.RemoveCallbacksForOwner(this);
         _handler.AcceptingInput = false;
     }
 }
Esempio n. 6
0
    private void onDeath(Damagable died)
    {
        _dead = true;

        for (int i = 0; i < this.Subs.Length; ++i)
        {
            this.Subs[i].Kill(0.0f);
        }

        _lerpMovement.HaltMovement();
        _timedCallbacks.AddCallback(this, destroy, 0.2f);

        if (this.DeathCallback != null)
        {
            DeathCallback(died);
        }
    }
Esempio n. 7
0
    public void BeginSpawn()
    {
        if (this.ChildSpawners == null || this.ChildSpawners.Count == 0)
        {
            _spawnPosition = this.transform.position;
            _spawning      = true;

            if (this.SpawnVisualPrefab != null)
            {
                Instantiate(this.SpawnVisualPrefab, this.transform.position, Quaternion.identity);
            }

            TimedCallbacks callbacks = this.GetComponent <TimedCallbacks>();
            if (callbacks != null)
            {
                callbacks.AddCallback(this, this.Spawn, this.SpawnDelay);
            }
            else
            {
                Spawn();
            }
        }
        else
        {
            _cooldownTimer = this.SpawnCooldown;

            for (int i = 0; i < this.ChildSpawners.Count; ++i)
            {
                if (this.ChildSpawners[i] != null)
                {
                    this.ChildSpawners[i].BeginSpawn();
                }
            }

            if (this.DestroyAfterSpawn)
            {
                Destroy(this.gameObject);
            }
        }
    }
 private void onDeath(int hp)
 {
     _dead = true;
     for (int i = 0; i < this.MinionSpawners.Count; ++i)
     {
         Destroy(this.MinionSpawners[i].gameObject);
     }
     this.LeftEye.GetComponent <Damagable>().Kill(50.0f);
     this.RightEye.GetComponent <Damagable>().Kill(50.0f);
     while (this.Shooters.Count > 0)
     {
         this.Shooters[this.Shooters.Count - 1].Kill(0.0f);
     }
     for (int i = 0; i < this.BossSubs.Count; ++i)
     {
         this.BossSubs[i].GetComponent <LerpMovement>().HaltMovement();
     }
     _timedCallbacks.AddCallback(this, triggerDeaths, this.DeathDelay);
     _timedCallbacks.AddCallback(this, this.WinCondition.EndLevel, this.EndLevelDelay);
     PersistentData.RegisterDefeatedMaster();
 }
Esempio n. 9
0
 private void prepareAttack()
 {
     _homePosition        = this.transform.position;
     _rotation.IsRotating = true;
     _timedCallbacks.AddCallback(this, attack, _attackDelay);
 }
Esempio n. 10
0
    void Start()
    {
        _currentAngle      = this.EnemyType.RotationOffset;
        _rotationAxis      = new Vector3(0, 0, 1);
        _weapon            = this.GetComponent <Weapon>();
        _rotationDirection = this.PossibleRotationDirections[Random.Range(0, this.PossibleRotationDirections.Length)];

        switch (this.EnemyType.MovementType)
        {
        default:
        case (int)MovementType.Free:
            _movementFunction = freeMovement;
            break;

        case (int)MovementType.Seek:
            _movementFunction = seekMovement;
            break;

        case (int)MovementType.MoveToward:
            _movementFunction = moveTowardMovement;
            break;
        }

        _actor = this.GetComponent <Actor2D>();
        if (_actor != null && this.EnemyType.MaxSpeed > 0.0f)
        {
            _actor.Velocity    = this.PossibleStartingVelocities.Length > 0 ? this.PossibleStartingVelocities[Random.Range(0, this.PossibleStartingVelocities.Length)] : Vector2.zero;
            _rotationDirection = this.PossibleRotationDirections[Random.Range(0, this.PossibleRotationDirections.Length)];
            this.localNotifier.Listen(CollisionEvent.NAME, this, this.OnCollide);
        }

        if (!this.UseDebugWeapon && this.WeaponType != null && _weapon != null)
        {
            _weapon.WeaponType = this.WeaponType;
        }

        Damager damager = this.GetComponent <Damager>();

        if (damager != null)
        {
            damager.Damage    = this.CollisionWeaponType.Damage;
            damager.Knockback = this.CollisionWeaponType.Knockback;
            damager.HitInvincibilityDuration = this.CollisionWeaponType.HitInvincibilityDuration;
        }

        Damagable damagable = this.GetComponent <Damagable>();

        if (damagable != null)
        {
            damagable.Health   = this.EnemyType.Health;
            damagable.Friction = this.EnemyType.Friction;

            if (this.CollisionWeaponType != null && this.CollisionWeaponType.SpecialEffect == WeaponType.SPECIAL_EXPLOSION)
            {
                damagable.OnDeathCallbacks.Add(onDeath);
            }
        }

        this.spriteRenderer.sprite = this.SpriteSheet.GetSprites()[this.EnemyType.SpriteName];
        GlobalEvents.Notifier.Listen(PlayerDiedEvent.NAME, this, playerDied);

        if (this.NoFire == false)
        {
            this.NoFire = true;
            TimedCallbacks callbacks = this.GetComponent <TimedCallbacks>();
            if (callbacks != null)
            {
                callbacks.AddCallback(this, fireOn, this.FireDelay);
            }
        }
    }