void MouseEvents_RIGHTCLICK(Ray qamRay, bool hold) { if ((!hold) && (!UnitMenuIsOn)) { if (!IsLocked) { if (MouseEvents.State.Position.AsUnitUnderCursor) { UnitScript ClickedUnit = MouseEvents.State.Position.AsUnitUnderCursor; if (IsOtherUnit(ClickedUnit.gameObject)) {//--------------- I think of adding anozher Menu like InteractionMenu or what. //-------------it would contain Interaction specific comamds like Guard, GroupMove, BuildAGroup, TakeLeadership, and so on... //-------------butt now this Rightclick will handle the focus to the other Unit and call it's CommandOptionsMenu ClickedUnit.gameObject.AddComponent <Focus>(); RightClickMenu.PopUpGUI(ClickedUnit); GUIScript.SelectedGroup.ResetGroup(); } else {//---------------the Focussed Unit (This unit) was Rightclicked self. RightClickMenu.PopUpGUI(UNIT); } } else {//------------ Rightclick on Ground... GameObject.Destroy(gameObject.GetComponent <Focus>()); } } else if (IsLockedToThis) { UNIT.Options.OptionsBase_RIGHTCLICK(qamRay, hold); } } }
public void AskForOrder() { RightClickMenu.PopUpGUI(this); }