void CheckForCommandIssue()
 {
     if (Input.GetButtonDown("Fire2"))
     {
         RaycastHit hit;
         if (MouseCast(out hit))
         {
             if (hit.transform.tag == "Character")
             {
                 currentSelection.AddCommand(new HuntCommand(hit, characterKillRadius));
             }
             else if (hit.transform.tag == "Item")
             {
                 currentSelection.AddCommand(new PickUpItemCommand(hit.transform.gameObject));
             }
             else if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
             {
                 currentSelection.AddCommand(new DropItemCommand(hit.point, item));
             }
             else
             {
                 currentSelection.AddCommand(new MoveCommand(hit.point));
             }
         }
     }
 }
예제 #2
0
    void CheckForCommandIssue()
    {
        if (Input.GetButtonDown("Fire2"))
        {
            RaycastHit hit;
            if (MouseCast(out hit))
            {
                if (hit.transform.tag == "Floor")
                {
                    currentSelection.AddCommand(new MoveCommand(hit.point));
                }
            }
        }

        //Toggle action1 command issuing
        if (Input.GetKeyDown(KeyCode.Keypad1) || Input.GetKeyDown(KeyCode.Alpha1))
        {
            action1 = !action1;
        }

        if (action1)
        {
            if (Input.GetButtonDown("Fire1"))
            {
                RaycastHit hit;
                if (MouseCast(out hit))
                {
                    if (hit.transform.tag == "Item")
                    {
                        currentSelection.AddCommand(new MoveCommand(hit.point));
                        currentSelection.AddCommand(new PickupCommand(hit.transform.gameObject));
                        action1 = false;
                    }
                    else if (hit.transform.tag == "Floor")
                    {
                        currentSelection.AddCommand(new MoveCommand(hit.point));
                        currentSelection.AddCommand(new DropCommand());
                        action1 = false;
                    }
                }
            }
        }
    }