Beispiel #1
0
    private void Charge()
    {
        GameObject a = AvatarRespawner.Instance.Avatar;

        if (a != null)
        {
            Debug.Log("Charging");
            moveScript.Move(VectorFunc.ConvertTo2DVec(a.transform.position - transform.position), moveSpeed);
        }
    }
    public Vector2 MoveSprite(Vector2 movement, float speed, bool running)
    {
        Vector2 dir = Vector2.zero;

        movement = movement.normalized * speed * Time.deltaTime;
        isMoving = movement != Vector2.zero;
        if (isMoving)
        {
            dir = movementScript.Move(movement);
        }
        if (isMoving)
        {
            FacingDirection = movement;
        }
        UpdateAnimation(FacingDirection, isMoving, running);
        return(dir);
    }
 private void Deg360Movement(float x, float y)
 {
     moveScript.Move(new Vector2(x, y), speed);
 }