Exemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (enabled == false)
     {
         return;
     }
     if (platformerManager.JudgePlayer(col.gameObject) == true)
     {
         onTouchingList.Add(new OnTouchingPlayer(col.gameObject.GetComponent <Player>()));
     }
 }
Exemplo n.º 2
0
    //if something touches the dead area
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (enabled == false)
        {
            return;
        }

        GameObject objTouched = collision.gameObject;

        //judge if it is a player
        if (platformerManager.JudgePlayer(objTouched) == true)
        {
            Player player = objTouched.GetComponent <Player>();
            player.Death(deadReason);

            //To avoid other players 'survive' by standing on the corpse, change collider to trigger.
            player.SetToTrigger2D();
            //To avoid corpse fly / move to somewhere else, immobilize it.
            player.SetToBeImmobilized2D();

            return;
        }

        //else.... clean up?
        Destroy(objTouched);
    }
Exemplo n.º 3
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (!executable)
        {
            return;
        }
        GameObject objTouched = collision.gameObject;

        if (!thePlatformerManager.JudgePlayer(objTouched))
        {
            return;
        }



        thePlatformerManager.Finish(objTouched);
        //status/overall change will happen in PFManager.Finish funct.
        //below, do the special effect.
        if (objTouched.GetComponent <Rigidbody2D>() != null)
        {
            playerCatched = objTouched;
            playerRb2D    = playerCatched.GetComponent <Rigidbody2D>();
            catched       = true;
        }
    }
Exemplo n.º 4
0
    //if something touches the dead area
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!executable)
        {
            return;
        }
        GameObject objTouched = collision.gameObject;

        //judge if it is a player
        if (thePlatformerManager.JudgePlayer(objTouched))
        {
            PFPlayer player = objTouched.GetComponent <PFPlayer>();
            player.DeathAndRespawn(deadReason);
        }
        else
        {
            //not character... destroy it to save resource?
            Destroy(objTouched);
        }
    }