예제 #1
0
    //When a message is received to apply the slow powerup
    public void OnReceiveSlowMessage(NetworkMessage networkMessage)
    {
        PowerupMessage slowMessage = networkMessage.ReadMessage <PowerupMessage> ();

        Debug.Log(slowMessage.x + " " + bounds[0] + "  " + bounds[1]);
        if (!BoundsChecker.checkValidBoundsTotal(slowMessage.x, bounds))
        {
            Debug.Log("Slow powerup in effect");
            activeVel = -0.2f;
            activeBlockControl.setVelocity(new Vector3(0, -0.2f, 0));
        }
    }
예제 #2
0
    //Detect powerup
    void OnTriggerStay2D(Collider2D other)
    {
        GameObject parentBlock = other.transform.parent.gameObject;

        if (parentBlock.CompareTag("DeadBlock"))
        {
            if (!base.getCollected())
            {
                base.setCollected(true);
                slowMessage   = new PowerupMessage();
                slowMessage.x = other.transform.position.x;
                gameObject.GetComponent <SpriteRenderer> ().enabled = false;
            }
        }
    }