예제 #1
0
    void Update( )
    {
        if (mumbletimer > 0)
        {
            mumbletimer -= Time.deltaTime;
        }

        // position
        if (mouseControlled)
        {
            //Vector2 mp = Uhh.MousePosition ( );
            //body.MovePosition (mp);

            if (ISGRABBING)
            {
                anim.Load("grab");
            }
            else
            {
                //Input.GetKey(KeyCode.Space)
                if (Input.GetKey("joystick button 0") && !justletgo)
                {
                    anim.Load("one");
                }
                else
                {
                    if (cangrab)
                    {
                        anim.Load("cangrab");
                    }
                    else
                    {
                        anim.Load("idle");
                    }
                }
            }
            if (fakeHand)
            {
                anim.color = Color.clear;
            }
            else
            {
                HandleGrabbing( );
            }
            // rotation
            Vector2 dir = arm.END - arm.MID;
            body.rotation = Uhh.AngleFromVector(dir);
        }
        else
        {
            if (STATIC)
            {
                // rotation
                Vector2 dir = arm.END - arm.MID;
                ROT = Uhh.AngleFromVector(dir);
            }
        }

        arm.UpdateLine(SHOULDER, POS);
    }
예제 #2
0
    void Update( )
    {
        if (updateself)
        {
            if (HASTARGET)
            {
                line.UpdateLine(POS, target.position);
            }
            else
            {
                line.UpdateLine(POS, Uhh.MousePosition( ));
            }

            // line.START = POS;

            // if (HASTARGET) line.END = target.position;
            // else {
            //  line.END = Uhh.MousePosition ( );
            //  if (Input.GetMouseButton (0)) line.hangamount = -4;
            //  else line.hangamount = 3;
            // }
        }
    }