Example #1
0
 private void Awake()
 {
     Instance = this;
     sr       = GetComponentInChildren <SpriteRenderer>();
     rb       = GetComponent <Rigidbody2D>();
     anim     = GetComponent <Animator>();
     elCanvas = GameObject.Find("elCanvas");
 }
Example #2
0
 private void Start()
 {
     playerControll = Player.GetComponent <Player2DControll>();
     //pauseMenu = GameObject.Find("pauseMenu");
     playerControll.enabled = true;
     ActivarMenu();
     DesactivarMenu();
 }
Example #3
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.transform.CompareTag("Player"))
        {
            player   = collision.gameObject;
            controll = player.GetComponent <Player2DControll>();
            body     = player.GetComponentInChildren <Rigidbody2D>();
            if (controll.slime)
            {
                switch ((int)Type)
                {
                case 0:
                    stuckOn.up = value;
                    break;

                case 1:
                    //stuckOn.down = -value;
                    break;

                case 2:
                    controll.stickOnWall = true;
                    stuckOn.left         = -value;
                    rotar = true;

                    body.MoveRotation(body.rotation + speed * Time.deltaTime);
                    break;

                case 3:
                    controll.stickOnWall = true;
                    stuckOn.right        = value;
                    rotar = true;
                    break;
                }
            }
        }
    }