Exemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Player" && isPlayer)
        {
            return;
        }
        if (col.tag == "Enemy" && !isPlayer)
        {
            return;
        }

        ExplosionManager exp = ObjectPool.Get <ExplosionManager>();

        exp.Initialize(transform.position, 4);

        if (damage == null)
        {
            return;
        }

        IDamagable target = col.GetComponent <IDamagable>();

        if (target != null)
        {
            target.Damage(damage);
        }

        Disable();
    }
Exemplo n.º 2
0
    private void Explode()
    {
        ExplosionManager exp = ObjectPool.Get <ExplosionManager>();

        exp.Initialize(transform.position, 4);
        Disable();
    }
Exemplo n.º 3
0
 private void OnHealthChanged(int value, int oldValue)
 {
     if (value < 1)
     {
         ExplosionManager expManager = ObjectPool.Instance.Get <ExplosionManager>();
         expManager.Initialize(transform.position, 7);
         Disable();
     }
 }
Exemplo n.º 4
0
    private void Disable()
    {
        ExplosionManager exp = ObjectPool.Get <ExplosionManager>();

        //shadow.Disable();
        exp.Initialize(transform.position, 10);

        WaveManager.Instance.RemoveActiveUFO(this);
        ObjectPool.Add(this);
    }
    /*
     * public void DisableControll() {
     *  //player.Write(Converter.toString(Request.DISABLECONTROLLER) + time);
     *  player.EnableControll(false);
     * }
     */

    private void OnHealthValueChange(int value, int oldValue)
    {
        int delta = value - oldValue;

        player.OnShipValueChange(AttributeType.HEALTH, value);

        PopUp.ShowText(transform.position, delta.ToString(), 0, Color.white);

        if (value < 1)
        {
            ExplosionManager expManager = ObjectPool.Instance.Get <ExplosionManager>();
            expManager.Initialize(transform.position, 10);
            player.Death();
        }
    }
Exemplo n.º 6
0
    private void OnHealthChanged(int value, int oldValue)
    {
        if (value < 1)
        {
            ExplosionManager expManager = ObjectPool.Instance.Get <ExplosionManager>();
            expManager.Initialize(transform.position, 6);

            if (transform.localScale.x > 1)
            {
                int qta = Random.Range(0, 4);
                for (int i = 0; i < qta; i++)
                {
                    Asteroid ast = ObjectPool.Instance.Get <Asteroid>();
                    ast.Initialize(transform.position);
                }
            }


            Disable();
        }
    }
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this.gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        OnEndGame   += overallUI.EndGame;
        audioManager = GetComponentInChildren <AudioManager>();

        ItemManager.Initialize();
        EnemiesManager.Initialize();
        ExplosionManager.Initialize();

        fragmentsManager = GetComponent <FragsManager>();
        loadManager      = GetComponent <LoadManager>();

        level = 1;
        Scene scene = SceneManager.GetActiveScene();

        if (scene.name == "Main Menu")
        {
            sceneNow = SceneNow.MainMenu;
        }
        else
        {
            sceneNow = SceneNow.Game;
        }

        GameData.LoadData();
        mapTypeIdNow = GameData.data.mapTypeIdNow;
        score        = GameData.data.score;
        Map.tiles    = generator.mapTypes[mapTypeIdNow].tileSet;
    }