Ejemplo n.º 1
0
    void FixedUpdate()
    {
        if (player == null)
        {
            try {
                player = GameObject.Find("TestPlayer(Clone)").GetComponent <Player>();
            } catch {
                //Debug.Log("Cannot find player for Glyph Recognition");
            }
        }

        if (Input.GetKey("1"))
        {
            Cast();
        }
        else if (Input.GetKey("tab"))
        {
            glyphInput.EndCustomDrag(glyphInput.GetPrevPos());
        }

        // Clean screen
        if (!groundCast)
        {
            if (img == null)
            {
                img = GetComponent <UnityEngine.UI.Image>();
            }
            if (img.color.a > 0f)
            {
                float newAlpha = (img.color.a - 0.05f);
                img.color = new Color(img.color.r, img.color.g, img.color.b, newAlpha);
            }
        }
    }
 void OnCollisionExit(Collision collision)
 {
     //Debug.Log("END: " +collision.gameObject);
     if (collision.gameObject.tag == "Player")
     {
         ContactPoint contact         = lastContactPoint;
         Vector3      localSpacePoint = transform.InverseTransformPoint(contact.point);
         Vector2      twospace        = new Vector2(-localSpacePoint.x, localSpacePoint.y);
         try {
             glyphDrawInput.EndCustomDrag(twospace);
         } catch {
             print("failure to end drag");
         }
     }
 }