Example #1
0
    void Move()
    {
        Vector3 tempVector = Vector3.right * Input.GetAxis("Horizontal");
        var     position   = transform.position;

        position           = Vector3.MoveTowards(position, position + tempVector, speed * Time.deltaTime);
        transform.position = position;
        if (tempVector.x < 0)
        {
            _sprite.flipX   = true;
            _directionPunch = DirectionPunch.left;
        }
        else
        {
            _sprite.flipX   = false;
            _directionPunch = DirectionPunch.rigth;
        }
    }
Example #2
0
 public Player(Transform position, Rigidbody2D player, DirectionPunch punch) :
     base(position, player)
 {
     Player = player;
     SetPunch(punch);
 }
Example #3
0
 private void SetPunch(DirectionPunch value)
 {
     punch = value;
 }