Example #1
0
        private void playerOnShapeEvent(Player.Shape shape)
        {
            if (shape == Player.Shape.Human)
            {
                this.SetScaleXY(0.75f, 1.75f);
            }

            if (shape == Player.Shape.Bird)
            {
                this.SetScaleXY(1, 1f);
            }

            if (shape == Player.Shape.Snake)
            {
                this.SetScaleXY(1f, 0.5f);
            }

            if (shape == Player.Shape.Bear)
            {
                this.SetScaleXY(3, 2);
            }

            if (shape == Player.Shape.Bear && _hitRight == true)
            {
                this.SetScaleXY(2, 2);
                _player.position.x -= 32;
            }
        }
Example #2
0
    public void Activate(Player player)
    {
        isActive = true;
        GetComponentInChildren <SpriteRenderer>().material = activeMaterial;

        if (player.currentCheckpoint && player.currentCheckpoint != this)
        {
            player.currentCheckpoint.Deactivate();
        }
        player.currentCheckpoint = this;

        playerState = player.state;
        LevelManager.instance.SaveStates();
    }
Example #3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (change)
        {
            change = false;
            return;
        }

        if (collision.tag.Equals("Player"))
        {
            change = true;
            Player player = collision.GetComponent <Player>();

            Player.Shape s = player.state;
            player.ChangeState(currentShape);
            ChangeShape(s);
        }
    }
Example #4
0
 public void ChangeShape(Player.Shape shape)
 {
     currentShape    = shape;
     renderer.sprite = sprites[(int)currentShape];
 }
Example #5
0
 private void Start()
 {
     renderer.sprite = sprites[(int)currentShape];
     savedShape      = currentShape;
 }