Esempio n. 1
0
    public override void Input()
    {
        Vector2 v2 = Vector2.zero;

        if (UnityEngine.Input.GetKey(up))
        {
            v2.y = 1;
        }
        if (UnityEngine.Input.GetKey(down))
        {
            v2.y = -1;
        }
        if (UnityEngine.Input.GetKey(left))
        {
            v2.x = 1;
        }
        if (UnityEngine.Input.GetKey(right))
        {
            v2.x = -1;
        }

        v2.Normalize();

        cachedVector.Assign(v2);
    }
    public override void Input()
    {
        Vector2 v = Vector2.zero;

        if (UnityEngine.Input.GetKey(up))
        {
            v.y += 1;
        }
        if (UnityEngine.Input.GetKey(down))
        {
            v.y -= 1;
        }
        if (UnityEngine.Input.GetKey(left))
        {
            v.x -= 1;
        }
        if (UnityEngine.Input.GetKey(right))
        {
            v.x += 1;
        }
        if (UnityEngine.Input.GetKey(jump) && m_grounded)
        {
            SoundManager.PlaySound("jumpSmall");
            m_animator.SetBool("Ground", false);
            m_rigidbody2D.AddForce(new Vector2(0, m_jumpForce));
            m_grounded = false;
        }

        v.Normalize();

        cacheVector.Assign(v);
    }
 public override void Input()
 {
     cachedVector.Assign((target.position - transform.position).normalized);
 }