Esempio n. 1
0
    void BecomeAlive()
    {
        if (name.Contains("Player"))
        {
            GridManagement.playerDead = false;
        }
        else
        {
            GridManagement.ClearPosition(transform.position, false, false); //get rid of what was there

            if (GridManagement.SetObjectToPosition(gameObject, transform.position, true, true, true))
            {
                //if this returns an object, its the player in a mode where the player should not be killed, so lose the block instead
                //stay dead i guess it would be
                return;
            }
            //track the fact that you are now solid and alive
            gridComp.solid = true;
            alive          = true;
            tag            = "Pushable";
            name           = "Live Cell";
            //visually become alive

            spriteComp.sortingOrder = 1;
            spriteComp.color        = Color.green;
        }
    }
Esempio n. 2
0
    void OnDestroy()
    {
        //being paranoid again, make absolute sure you are removed from the grids before being destroyed
        //but this shouldn't really ever get called
        if (GridManagement.IsInGrid(gameObject))
        {
            GridManagement.ClearPosition(GridManagement.GetPositionOfObject(gameObject), solid);
        }


        GridMovementGeneral.StopCoroutines(gameObject); //and stop any movement coroutines that are on it
    }
Esempio n. 3
0
    void BecomeDead()
    {
        if (name.Contains("Player"))
        {
            GridManagement.playerDead = true;
        }
        else
        {
            GridManagement.ClearPosition(transform.position, true, false);                         //get rid of what was there

            GridManagement.SetObjectToPosition(gameObject, transform.position, true, true, false); //spawn a dead there
                                                                                                   //track that you are now dead
            gridComp.solid = false;
            alive          = false;
            tag            = "Untagged";

            name = "Dead Cell";
            //viz
            spriteComp.sortingOrder = 0;
            spriteComp.color        = Color.clear;
        }
    }