Пример #1
0
 private void Start()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(this);
     }
 }
Пример #2
0
    void Start()
    {
        er = GetComponent <EnemyRecovery>();

        doorOnePosition   = new Vector2(9.61f, -3.27f);
        doorTwoPosition   = new Vector2(-7f, -2.2f);
        doorThreePosition = new Vector2(-7f, 5f);
        doorFourPosition  = new Vector2(6.8f, 4.6f);
        centerPosition    = new Vector2(0f, 0.7f);

        //6 enemies in the center in the first call
        createEnemiesCenter <EnemySkeleton>(2);
        createEnemiesCenter <EnemySkeletonArcher>(2);
        createEnemiesCenter <EnemyBat>(2);
    }
Пример #3
0
    /**
     * Method to "kill" the enemy, really it put setActive(false) and change variable IsAlive to false.
     * Use the EnemyRecovery Class to findEnemy in the Enemies Alive and save in the list EnemyDie.
     *
     * Use GameManager to increase the score
     *
     * @see GameManager#UpScore
     * @see GameManager#Instance
     * @see EnemyRecovery#SaveEnemyDie
     */
    public void Die()
    {
        if (IsAlive)
        {
            //gameObject.GetComponent<CapsuleCollider2D>().enabled = false;

            //TODO: reproduce animation, how? Y_Y
            //PlayAnimation("SkeletonDie");
            //Translate position of the enemy to simulate destroying this.
            DropObject.InstantiateCachableObject(gameObject.transform.position);

            transform.position = new Vector3(-100f, -100f, 0f);

            gameObject.SetActive(false);

            EnemyRecovery er = FindObjectOfType <EnemyRecovery>();
            er.SaveEnemyDie(this);

            //TODO: Need calculate score
            GameManager.Instance.UpScore(100);
        }
        IsAlive = false;
    }
Пример #4
0
 void Start()
 {
     er = FindObjectOfType <EnemyRecovery>();
 }