Beispiel #1
0
    void Update()
    {
        if (mHuman)
        {
            if (mSelectedList.Count == 0)
            {
                mHud.clearSelection();
            }
            //check if there is a popmenu and if it has an outcome
            if (mHuman && mHud.mPopMenu.isActive())
            {
                //Debug.Log("Need to fix PopMenu to work with multiple selections");

                /*if (mHud.mPopMenu.mOutcome == true)
                 * {
                 *  EntityAction ent_act = (EntityAction)mSelectedObject;
                 *  //if control is held down queue the action
                 *  if (ent_act)
                 *      if (Input.GetKey(KeyCode.LeftControl))
                 *          ent_act.addAction(mHud.mPopMenu.mOutcomeAction, "append");
                 *      else
                 *          ent_act.addAction(mHud.mPopMenu.mOutcomeAction);
                 *  mHud.mPopMenu.setActive(false);
                 * }*/
                if (mHud.mPopMenu.mOutcome == true)
                {
                    foreach (Entity ent in mSelectedList)
                    {
                        EntityAction ent_act = (EntityAction)ent;
                        //if control is held down queue the action
                        if (ent_act)
                        {
                            if (Input.GetKey(KeyCode.LeftControl))
                            {
                                ent_act.addAction(Instantiate(mHud.mPopMenu.mOutcomeAction, ent_act.transform), "append");
                            }
                            else
                            {
                                ent_act.addAction(Instantiate(mHud.mPopMenu.mOutcomeAction, ent_act.transform));
                            }
                        }
                    }
                    mHud.mPopMenu.setActive(false);
                }
            }
            //make icons to display info to the user
            setIdleUnitIcons();
        }
    }