public void FreePools()
 {
     DDRed.FreePools();
     DDYellow.FreePools();
     DDWhite.FreePools();
     DDBlue.FreePools();
     ExplodeAnim.FreePools();
 }
    void OnTriggerEnter2D(Collider2D other)
    {
        DDRed foe = other.GetComponent <DDRed>();

        if (foe != null && flashing == 0f)
        {
            flashing = 3f;
            LifeCounter.instance.Death();
            path.Clear();
        }
    }
Example #3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag != "Player")
        {
            DDRed foe = other.GetComponent <DDRed>();

            if (foe != null)
            {
                Death();
                foe.Death();
            }
        }
    }
    void InitRed()
    {
        DDRed.poolOn  = new List <DDRed>();
        DDRed.poolOff = new List <DDRed>();

        for (int i = 0; i < 2; ++i)
        {
            for (int j = 0; j < 5; ++j)
            {
                DDRed red = DDRed.CreateFromPool();
                red.transform.localPosition = new Vector3(22 + i * 4, 10 + j * 4, 0) * 16;
                wallsInit[j * 64 + i]       = true;
            }
        }
    }
Example #5
0
    static public DDRed CreateFromPool()
    {
        DDRed result = null;

        if (poolOff.Count == 0)
        {
            GameObject tmp = Instantiate <GameObject>(DDMapCreator.instance.squareReferences.redRef.gameObject);
            tmp.transform.SetParent(DDMapCreator.instance.transform);
            tmp.transform.localScale = Vector3.one;
            result          = tmp.GetComponent <DDRed>();
            result.imgIndex = 0;
            poolOn.Add(result);
        }
        else
        {
            result = poolOff[0];
            poolOn.Add(result);
            poolOff.RemoveAt(0);
        }
        return(result);
    }
Example #6
0
    public void OnPlaceOnMap()
    {
        if (active)
        {
            Vector3 target;

            target.x = Mathf.FloorToInt(((Input.mousePosition.x - Screen.width / 2) / DDMapCreator.instance.transform.lossyScale.x - DDMapCreator.instance.transform.localPosition.x) / 16);
            target.y = Mathf.FloorToInt(((Input.mousePosition.y - Screen.height / 2) / DDMapCreator.instance.transform.lossyScale.x - DDMapCreator.instance.transform.localPosition.y) / 16);
            target.z = 0;

            if (redSelected == true)
            {
                DDRed newFoe = DDRed.CreateFromPool();
                newFoe.transform.localPosition = target * 16;
            }

            if (redSelected == false)
            {
                DDYellow newTrap = DDYellow.CreateFromPool();
                newTrap.transform.localPosition = target * 16;
            }
        }
    }