Esempio n. 1
0
    private void Start()
    {
        BossAttackScript bossAttackScript = GetComponent <BossAttackScript>();

        bossAttackScript.OnSickleThrow += OnSickleThrow;

        FeetScript feetScript = GetComponentInChildren <FeetScript>();

        feetScript.OnFeetTouch += OnFeetTouch;

        RadarFar radarFar = GetComponentInChildren <RadarFar>();

        radarFar.OnPlayerEnterRadar += OnPlayerEnterRadarFar;
        radarFar.OnPlayerLeaveRadar += OnPlayerLeaveRadarFar;

        RadarNear radarNear = GetComponentInChildren <RadarNear>();

        radarNear.OnPlayerStayRadar += OnPlayerStayRadarNear;
    }
Esempio n. 2
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        Debug.Log("You exit collision.");
        if (collision.transform.CompareTag("PlayerHead"))
        {
            PlayerScript playerScript = collision.transform.GetComponentInParent <PlayerScript>();
            playerScript.feetContact = 0;
            playerScript.doublejump  = true;
            if (!playerScript.onWall)
            {
                collision.transform.GetComponent <HeadScript>().numCollided -= 1;
            }
        }

        if (collision.transform.CompareTag("PlayerFeet"))
        {
            PlayerScript playerScript = collision.transform.GetComponentInParent <PlayerScript>();
            FeetScript   fscript      = collision.transform.GetComponent <FeetScript>();
            fscript.numCollided     -= 1;
            playerScript.feetContact = 0;
            playerScript.doublejump  = true;

            if (fscript.numCollided == 0)
            {
                if (playerScript.headFirst)
                {
                    playerScript.GravityChange(true);
                    playerScript.FlipPlayerY();
                    //playerScript = false;
                }

                playerScript.movespeed += 1;

                Debug.Log("foot: speed is now " + playerScript.movespeed);
            }
        }

        if (collision.transform.CompareTag("PlayerRight") || collision.transform.CompareTag("PlayerLeft"))
        {
            PlayerScript playerScript = collision.transform.GetComponentInParent <PlayerScript>();
            playerScript.numCollided -= 1;
            playerScript.feetContact  = 0;
            playerScript.doublejump   = true;

            if (collision.transform.CompareTag("PlayerRight"))
            {
                playerScript.rightCollided -= 1;
            }
            if (collision.transform.CompareTag("PlayerLeft"))
            {
                playerScript.leftCollided -= 1;
            }


            Rigidbody2D playerRB = playerScript.playerRB;

            if (playerScript.numCollided == 0 && playerScript.onWall)
            {
                Debug.Log("side: speed is now " + playerScript.movespeed);
                playerRB.gravityScale = 1f;
                //playerScript.movespeed += slow_amount;
                playerScript.onWall = false;
            }
            //playerRB.velocity =;
        }
    }
Esempio n. 3
0
 private void Start()
 {
     rigidbody  = GetComponent <Rigidbody2D>();
     feetScript = GetComponentInChildren <FeetScript>();
 }