public void AttemptToHold(ServiceLocator.ID id) { if (id == ServiceLocator.ID.p0) { if (_objIntModel.p0_InteractableInterested.cat == ServiceLocator.ThingCategory.Items) { Item_Base i = _objIntModel.p0_InteractableInterested as Item_Base; if (i != null) { i.state = ServiceLocator.ItemStates.Held; _objIntModel.SetGrabbed(id, _objIntModel.p0_InteractableInterested); _objIntModel.SetInteractableInterested(id, null); Debug.Log("Grabbed is of type " + _objIntModel.p0_InteractableGrabbed + ". It's enum type is " + _objIntModel.p0_InteractableGrabbed.type.ToString() + "."); } } else if (_objIntModel.p0_InteractableInterested.cat == ServiceLocator.ThingCategory.Equipment) { Equipment_Base e = _objIntModel.p0_InteractableInterested as Equipment_Base; if (e != null) { if (e.state == ServiceLocator.EquipmentStates.Loose) { e.state = ServiceLocator.EquipmentStates.Held; _objIntModel.SetGrabbed(id, _objIntModel.p0_InteractableInterested); _objIntModel.SetInteractableInterested(ServiceLocator.ID.p0, null); } } } } }
public Task_EjectThing(MP4_Task queuedTask, ServiceLocator.ID id, Equipment_Base ejector, Command cmd, CommandReferences cRef) : base(TaskType.Scheduled_Pauseable, queuedTask) { playerID = id; this.ejector = ejector; this.cmd = cmd; this.cRef = cRef; }
private bool _IntendedTargetPresent(ServiceLocator.ID id, Equipment_Base e, Command cmd) { // Internal targets if (cmd.action == ServiceLocator.Actions.Charge || cmd.action == ServiceLocator.Actions.Eject || cmd.action == ServiceLocator.Actions.Unstow) { List <ServiceLocator.ThingType> _stowedTypes = new List <ServiceLocator.ThingType>(); foreach (Thing t in e.stowed) { _stowedTypes.Add(t.type); } if (_stowedTypes.Contains(cmd.target)) { return(true); } else { return(false); } } // External targets else { if (_objIntModel.CountOfTypeInOOC(id, cmd.target) != 0) { return(true); } else { return(false); } } }
private bool _Helper_CheckReagentPresence(ServiceLocator.ID id, Command cmd) { if (cmd.reagents.Length == 0) { return(true); } else { List <ServiceLocator.ThingType> typesPresent = new List <ServiceLocator.ThingType>(); for (int i = 0; i < _objIntModel.p0_Interactable_ObjsOfConcern.Length; i++) { if (id == ServiceLocator.ID.p0) { typesPresent.Add(_objIntModel.p0_Interactable_ObjsOfConcern[i].type); } else { typesPresent.Add(_objIntModel.p1_Interactable_ObjsOfConcern[i].type); } } foreach (Reagent r in cmd.reagents) { if (!typesPresent.Contains(r.reagentType.type)) { return(false); } } } return(true); }
private void _StoreConsumablesRefs(ServiceLocator.ID id, CommandReferences cRef, Command cmd) { foreach (Thing t in cmd.consumables) { cRef.consumableRefs.Add(_objIntModel.ClosestThingOfTypeInOOC(id, t.type)); } }
public Task_UnstowThing(MP4_Task queuedTask, ServiceLocator.ID id, Equipment_Base eqpt, Command cmd, CommandReferences cRef) : base(TaskType.Scheduled_Pauseable, queuedTask) { playerID = id; this.installer = eqpt; this.cmd = cmd; this.cRef = cRef; }
public void ExecuteCommand(ServiceLocator.ID id) { //------------------------------ //Item resource consumption should be relocated to objInteractionController //------------------------------ if (id == ServiceLocator.ID.p0) { Command cmd; _eqptMenuModel.p0EqptCommandSeq.TryGetValue(_gameModel.EqptMenuSelect_P0, out cmd); //foreach (int sd in _eqptMenuModel.p0EqptCommandSeq.Keys) //{ // Debug.Log(sd); // Command asdasd; // _eqptMenuModel.p0EqptCommandSeq.TryGetValue(sd, out asdasd); // Debug.Log(asdasd.target.ToString()); // CommandReferences ddd; // _eqptMenuModel.p0EqptCommandsActive.TryGetValue(asdasd, out ddd); // Debug.Log(ddd.name); // if (ddd.target != null) // Debug.Log("YAAAAAAAAAAAAAAAAAAAAAAAAY NOT NULL"); //} CommandReferences cRef; _eqptMenuModel.p0EqptCommandsActive.TryGetValue(cmd, out cRef); if (cmd.action == ServiceLocator.Actions.Install) { //_objIntCtrlr.StowAndInstall(_eqptMenuModel.p0eqpt, cRef.target); ServiceLocator.Instance.TaskManager.StartTask(new Task_InstallThing(null, id, _eqptMenuModel.p0eqpt, cmd, cRef)); } else if (cmd.action == ServiceLocator.Actions.Stow) { //_objIntCtrlr.StowAndInstall(_eqptMenuModel.p0eqpt, cRef.target); ServiceLocator.Instance.TaskManager.StartTask(new Task_StowThing(null, id, _eqptMenuModel.p0eqpt, cmd, cRef)); } else if (cmd.action == ServiceLocator.Actions.Eject) { //Debug.Log(cRef.target.name); //_objIntCtrlr.Eject(_eqptMenuModel.p0eqpt, cRef.target); ServiceLocator.Instance.TaskManager.StartTask(new Task_EjectThing(null, id, _eqptMenuModel.p0eqpt, cmd, cRef)); } else if (cmd.action == ServiceLocator.Actions.Unstow) { //_objIntCtrlr.Unstow(_eqptMenuModel.p0eqpt, cRef.target); ServiceLocator.Instance.TaskManager.StartTask(new Task_UnstowThing(null, id, _eqptMenuModel.p0eqpt, cmd, cRef)); } else if (cmd.action == ServiceLocator.Actions.Exit) { _gameModel.SetControlState(ServiceLocator.ID.p0, ServiceLocator.ControlStates.Free); } } //_gameModel.SetControlState(id, ServiceLocator.ControlStates.Free); }
private void _CheckPlayerInteractable(ServiceLocator.ID id) { p0Look.origin = _p0.position + _tuning_PlayerTransformToHeadOffset; p0Look.direction = _gameModel.P0_LookDir; Debug.DrawLine(p0Look.origin, p0Look.origin + (p0Look.direction * _tuning_InteractionRange)); Physics.SphereCast(p0Look, .25f, out p0Cast, _tuning_InteractionRange, selectInteractables, QueryTriggerInteraction.Collide); }
public void SetControlState(ServiceLocator.ID id, ServiceLocator.ControlStates newControlState) { if (id == ServiceLocator.ID.p0) { CtrlState_P0 = newControlState; } else { CtrlState_P1 = newControlState; } }
public void SetDrop(ServiceLocator.ID id) { if (id == ServiceLocator.ID.p0) { p0_InteractableGrabbed = null; } else { p1_InteractableGrabbed = null; } }
public void SetOOCs(ServiceLocator.ID id, Thing[] OOCs) { if (id == ServiceLocator.ID.p0) { p0_Interactable_ObjsOfConcern = OOCs; } else { p1_Interactable_ObjsOfConcern = OOCs; } }
public void SetLookDir(ServiceLocator.ID id, Vector3 lookDir) { if (id == ServiceLocator.ID.p0) { P0_LookDir = lookDir; } else { P1_LookDir = lookDir; } }
public void SetInteractableInterested(ServiceLocator.ID id, Thing interactable) { if (id == ServiceLocator.ID.p0) { p0_InteractableInterested = interactable; } else { p1_InteractableInterested = interactable; } }
public void SetHands(ServiceLocator.ID id, Transform hands) { if (id == ServiceLocator.ID.p0) { P0_Hands = hands; } else { P1_Hands = hands; } }
public void SetGrabbed(ServiceLocator.ID id, Thing grabbedThing) { if (id == ServiceLocator.ID.p0) { p0_InteractableGrabbed = grabbedThing; //Debug.Log("Hello! This is the model. The grabbed thing is " + grabbedThing.ToString()); } else { p1_InteractableGrabbed = grabbedThing; } }
private bool _ReqdConsumablesPresent(ServiceLocator.ID id, Command cmd) { bool present = true; foreach (Thing t in cmd.consumables) { if (_objIntModel.CountOfTypeInOOC(id, t.type) == 0) { present = false; } } return(present); }
private void _PassToModelOOCs(ServiceLocator.ID id) { if (_objIntModel.p0_InteractableInterested != null) { scratchColliderArray = Physics.OverlapSphere(_objIntModel.GetWhereIsThing(_objIntModel.p0_InteractableInterested), _tuning_OOCRange, selectInteractables); if (scratchColliderArray.Length != 0) { scratchThingArray = new Thing[scratchColliderArray.Length]; for (int i = 0; i < scratchColliderArray.Length; i++) { scratchThingArray[i] = scratchColliderArray[i].gameObject.GetComponent <ViewThing_Generic>().obvservedDataGeneric; } } else { scratchThingArray = new Thing[0]; } } else { scratchThingArray = new Thing[0]; } _objIntModel.SetOOCs(ServiceLocator.ID.p0, scratchThingArray); //-------------- // Mirror for p1 //-------------- if (_objIntModel.p1_InteractableInterested != null) { scratchColliderArray = Physics.OverlapSphere(_objIntModel.GetWhereIsThing(_objIntModel.p1_InteractableInterested), _tuning_OOCRange); if (scratchColliderArray.Length != 0) { scratchThingArray = new Thing[scratchColliderArray.Length]; for (int i = 0; i < scratchColliderArray.Length; i++) { scratchThingArray[i] = scratchColliderArray[i].gameObject.GetComponent <ViewThing_Generic>().obvservedDataGeneric; } } else { scratchThingArray = new Thing[0]; } } else { scratchThingArray = new Thing[0]; } _objIntModel.SetOOCs(ServiceLocator.ID.p1, scratchThingArray); }
public void SetCommands(ServiceLocator.ID id, Equipment_Base eqpt, Dictionary <Command, CommandReferences> refsDict, Dictionary <int, Command> cmdSeq) { if (id == ServiceLocator.ID.p0) { p0EqptCommandsActive = refsDict; p0EqptCommandSeq = cmdSeq; p0eqpt = eqpt; } else { p1EqptCommandsActive = refsDict; p1EqptCommandSeq = cmdSeq; p1eqpt = eqpt; } }
private void _StoreReagentsRefs(ServiceLocator.ID id, Equipment_Base e, CommandReferences cRef, Command cmd) { if (cmd.reagents.Length == 0) { return; } else { // For some check the equipment's stowed list if (cmd.action == ServiceLocator.Actions.Weld || cmd.action == ServiceLocator.Actions.Power || cmd.action == ServiceLocator.Actions.Charge || cmd.action == ServiceLocator.Actions.Eject || cmd.action == ServiceLocator.Actions.Unstow) { // For actions that require that reagents be internally present: // -Check to see if a given stowed item meets the requirements of the cmd // - Then make sure that the ref for the cmd doesn't already contain a redundant one // - If that's good, then add the given stowed item to the refs for (int i = 0; i < e.stowed.Count; i++) { for (int j = 0; j < cmd.reagents.Length; j++) { if (e.stowed[i].type == cmd.reagents[j].reagentType.type) { List <ServiceLocator.ThingType> storedReferenceTypes = new List <ServiceLocator.ThingType>(); foreach (Item_Base iB in cRef.reagentRefs) { storedReferenceTypes.Add(iB.type); } if (!storedReferenceTypes.Contains(cmd.reagents[j].reagentType.type)) { Debug.Log("Item of type of reagent specified type stored. Item is " + e.stowed[i].name.ToString()); cRef.reagentRefs.Add(e.stowed[i] as Item_Base); } } } } } // For others, check the area else { foreach (Reagent r in cmd.reagents) { cRef.reagentRefs.Add(_objIntModel.ClosestThingOfTypeInOOC(id, r.reagentType.type) as Item_Base); } } } }
private void _PopulateMenu(ServiceLocator.ID id) { if (id == ServiceLocator.ID.p0) { _title_p0.GetComponent <Text>().text = _eqptMenuModel.p0eqpt.type.ToString() + " Operation"; for (int i = 0; i < _eqptMenuModel.p0EqptCommandsActive.Count; i++) { Command cmd; _eqptMenuModel.p0EqptCommandSeq.TryGetValue(i, out cmd); Debug.Log(cmd.name.ToString()); _menuOptionsText_p0.Add(cmd.action.ToString() + " " + cmd.target.ToString()); } for (int i = 0; i < _menuOptionsText_p0.Count; i++) { _menuOptionsTransforms_p0.Add(Instantiate(_option1_p0, _menuParent_p0)); _menuOptionsTransforms_p0[i].transform.localPosition = _p0Option1Anchor + Vector3.down * 100 * i; _menuOptionsTransforms_p0[i].GetComponent <Text>().text = _menuOptionsText_p0[i]; } } else { _title_p1.GetComponent <Text>().text = _eqptMenuModel.p1eqpt.type.ToString() + " Operation"; for (int i = 0; i < _eqptMenuModel.p1EqptCommandsActive.Count; i++) { Command cmd; _eqptMenuModel.p1EqptCommandSeq.TryGetValue(i, out cmd); _menuOptionsText_p1.Add(cmd.action.ToString() + " " + cmd.target.ToString()); } for (int i = 0; i < _menuOptionsText_p1.Count; i++) { _menuOptionsTransforms_p1.Add(Instantiate(_option1_p1, _menuParent_p1)); _menuOptionsTransforms_p1[i].transform.localPosition = _p1Option1Anchor + Vector3.down * 100 * i; _menuOptionsTransforms_p1[i].GetComponent <Text>().text = _menuOptionsText_p1[i]; } } }
private void _PassToModelInteractables(ServiceLocator.ID id) { if (p0Cast.collider != null) { _objIntModel.SetInteractableInterested(ServiceLocator.ID.p0, p0Cast.transform.GetComponent <ViewThing_Generic>().obvservedDataGeneric); } else { _objIntModel.SetInteractableInterested(ServiceLocator.ID.p0, null); } if (p1Cast.collider != null) { _objIntModel.SetInteractableInterested(ServiceLocator.ID.p1, p1Cast.transform.GetComponent <ViewThing_Generic>().obvservedDataGeneric); } else { _objIntModel.SetInteractableInterested(ServiceLocator.ID.p1, null); } }
public int CountOfTypeInOOC(ServiceLocator.ID id, ServiceLocator.ThingType type) { if (id == ServiceLocator.ID.p0) { if (p0_Interactable_ObjsOfConcern.Length == 0) { return(0); } else { int counter = 0; for (int i = 0; i < p0_Interactable_ObjsOfConcern.Length; i++) { if (p0_Interactable_ObjsOfConcern[i].type == type) { counter++; } } return(counter); } } else { if (p1_Interactable_ObjsOfConcern.Length == 0) { return(0); } else { int counter = 0; for (int i = 0; i < p1_Interactable_ObjsOfConcern.Length; i++) { if (p1_Interactable_ObjsOfConcern[i].type == type) { counter++; } } return(counter); } } }
private bool _ReqdReagentConditionsMet(ServiceLocator.ID id, Equipment_Base e, Command cmd) { // For each cmd action type, a different logical check should be done to determine the specific conditional state for the action if (cmd.action == ServiceLocator.Actions.Weld || cmd.action == ServiceLocator.Actions.Power) { // Check stowage & capacity if (_Helper_CheckReagentStowage(e, cmd) && _Helper_CheckReagentCapacity(e, cmd)) { return(true); } else { return(false); } } else if (cmd.action == ServiceLocator.Actions.Charge || cmd.action == ServiceLocator.Actions.Eject || cmd.action == ServiceLocator.Actions.Unstow) { // Check stowage if (_Helper_CheckReagentStowage(e, cmd)) { return(true); } else { return(false); } } else { // Check presence in vicinity if (_Helper_CheckReagentPresence(id, cmd)) { return(true); } else { return(false); } } }
private void _StoreTargetRefs(ServiceLocator.ID id, Equipment_Base e, CommandReferences cRef, Command cmd) { if (cmd.action == ServiceLocator.Actions.Charge || cmd.action == ServiceLocator.Actions.Eject || cmd.action == ServiceLocator.Actions.Unstow) { foreach (Thing t in e.stowed) { Item_Base iB = t as Item_Base; Equipment_Base eB = t as Equipment_Base; if (iB != null) { if (iB.type == cmd.target) { Debug.Log("CREF!!! --- " + cmd.target.ToString() + " should match with " + iB.type.ToString()); cRef.target = iB; Debug.Log("CREF!!! --- " + cRef.target.ToString()); break; } } else if (eB != null) { if (eB.type == cmd.target) { Debug.Log("CREF!!! --- " + cmd.target.ToString() + " should match with " + eB.type.ToString()); cRef.target = eB; Debug.Log("CREF!!! --- " + cRef.target.ToString()); break; } } } } else { cRef.target = _objIntModel.ClosestThingOfTypeInOOC(id, cmd.target); } }
private bool _SpecialConditions(ServiceLocator.ID id, Equipment_Base e, Command cmd) { if (cmd.action == ServiceLocator.Actions.Install) { List <ServiceLocator.ThingType> installedTypes = new List <ServiceLocator.ThingType>(); for (int i = 0; i < e.stowed.Count; i++) { installedTypes.Add(e.stowed[i].type); } if (installedTypes.Contains(cmd.target)) { return(false); } else { return(true); } } else { return(true); } }
public void Unhold(ServiceLocator.ID id) { if (id == ServiceLocator.ID.p0) { if (_objIntModel.p0_InteractableGrabbed.cat == ServiceLocator.ThingCategory.Items) { Item_Base i = _objIntModel.p0_InteractableGrabbed as Item_Base; if (i != null) { i.state = ServiceLocator.ItemStates.Loose; _objIntModel.SetDrop(ServiceLocator.ID.p0); } } else if (_objIntModel.p0_InteractableGrabbed.cat == ServiceLocator.ThingCategory.Equipment) { Equipment_Base e = _objIntModel.p0_InteractableGrabbed as Equipment_Base; if (e != null) { e.state = ServiceLocator.EquipmentStates.Loose; _objIntModel.SetDrop(ServiceLocator.ID.p0); } } } }
public Thing ClosestThingOfTypeInOOC(ServiceLocator.ID id, ServiceLocator.ThingType type) { Thing[] examinedOOC; Thing examinedObjectOfInterest; if (id == ServiceLocator.ID.p0) { examinedOOC = p0_Interactable_ObjsOfConcern; examinedObjectOfInterest = p0_InteractableInterested; } else { examinedOOC = p1_Interactable_ObjsOfConcern; examinedObjectOfInterest = p1_InteractableInterested; } // if there's nothing, closest is nothing if (examinedOOC.Length == 0) { return(null); } // if there's something in the list, but none of the right type, closest is nothing else if (CountOfTypeInOOC(id, type) == 0) { return(null); } // if there's one of type, then the closest is only one else if (CountOfTypeInOOC(id, type) == 1) { for (int i = 0; i < examinedOOC.Length; i++) { if (examinedOOC[i].type == type) { return(examinedOOC[i]); } } } // if there's more than one of type, then the closest must be found in order to be returned else { List <Thing> allOfTypeInOOC = new List <Thing>(); for (int i = 0; i < examinedOOC.Length; i++) { if (examinedOOC[i].type == type) { allOfTypeInOOC.Add(examinedOOC[i]); } } float shortestDist = 9999999; Thing currentClosestThing = null; for (int i = 0; i < allOfTypeInOOC.Count; i++) { Vector3 pos1 = GetWhereIsThing(examinedObjectOfInterest); Vector3 pos2 = GetWhereIsThing(allOfTypeInOOC[i]); if (Vector3.Distance(pos1, pos2) < shortestDist) { currentClosestThing = allOfTypeInOOC[i]; } } return(currentClosestThing); } return(null); }
//// -- P0 --------------------------------------------------------------------- //public bool P0_Up_OnDown { get; private set; } //public bool P0_Up_IsDown { get; private set; } //public bool P0_Up_OnUp { get; private set; } //public bool P0_Down_OnDown { get; private set; } //public bool P0_Down_IsDown { get; private set; } //public bool P0_Down_OnUp { get; private set; } //public bool P0_Left_OnDown { get; private set; } //public bool P0_Left_IsDown { get; private set; } //public bool P0_Left_OnUp { get; private set; } //public bool P0_Right_OnDown { get; private set; } //public bool P0_Right_IsDown { get; private set; } //public bool P0_Right_OnUp { get; private set; } //public bool P0_Use_OnDown { get; private set; } //public bool P0_Use_IsDown { get; private set; } //public bool P0_Use_OnUp { get; private set; } //public bool P0_Grab_OnDown { get; private set; } //public bool P0_Grab_IsDown { get; private set; } //public bool P0_Grab_OnUp { get; private set; } //// -- P1 --------------------------------------------------------------------- //public bool P1_Up_OnDown { get; private set; } //public bool P1_Up_IsDown { get; private set; } //public bool P1_Up_OnUp { get; private set; } //public bool P1_Down_OnDown { get; private set; } //public bool P1_Down_IsDown { get; private set; } //public bool P1_Down_OnUp { get; private set; } //public bool P1_Left_OnDown { get; private set; } //public bool P1_Left_IsDown { get; private set; } //public bool P1_Left_OnUp { get; private set; } //public bool P1_Right_OnDown { get; private set; } //public bool P1_Right_IsDown { get; private set; } //public bool P1_Right_OnUp { get; private set; } //public bool P1_Use_OnDown { get; private set; } //public bool P1_Use_IsDown { get; private set; } //public bool P1_Use_OnUp { get; private set; } //public bool P1_Grab_OnDown { get; private set; } //public bool P1_Grab_IsDown { get; private set; } //public bool P1_Grab_OnUp { get; private set; } public void SetInputStates(ServiceLocator.ID id, ServiceLocator.Inputs input, ServiceLocator.InputStates state, bool newVal) { if (id == ServiceLocator.ID.p0) { if (input == ServiceLocator.Inputs.Up) { if (state == ServiceLocator.InputStates.OnDown) { P0_Up_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P0_Up_IsDown = newVal; } else { P0_Up_OnUp = newVal; } } else if (input == ServiceLocator.Inputs.Down) { if (state == ServiceLocator.InputStates.OnDown) { P0_Down_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P0_Down_IsDown = newVal; } else { P0_Down_OnUp = newVal; } } else if (input == ServiceLocator.Inputs.Left) { if (state == ServiceLocator.InputStates.OnDown) { P0_Left_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P0_Left_IsDown = newVal; } else { P0_Left_OnUp = newVal; } } else if (input == ServiceLocator.Inputs.Right) { if (state == ServiceLocator.InputStates.OnDown) { P0_Right_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P0_Right_IsDown = newVal; } else { P0_Right_OnUp = newVal; } } else if (input == ServiceLocator.Inputs.Use) { if (state == ServiceLocator.InputStates.OnDown) { P0_Use_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P0_Use_IsDown = newVal; } else { P0_Use_OnUp = newVal; } } else if (input == ServiceLocator.Inputs.Grab) { if (state == ServiceLocator.InputStates.OnDown) { P0_Grab_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P0_Grab_IsDown = newVal; } else { P0_Grab_OnUp = newVal; } } } else { if (input == ServiceLocator.Inputs.Up) { if (state == ServiceLocator.InputStates.OnDown) { P1_Up_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P1_Up_IsDown = newVal; } else { P1_Up_OnUp = newVal; } } else if (input == ServiceLocator.Inputs.Down) { if (state == ServiceLocator.InputStates.OnDown) { P1_Down_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P1_Down_IsDown = newVal; } else { P1_Down_OnUp = newVal; } } else if (input == ServiceLocator.Inputs.Left) { if (state == ServiceLocator.InputStates.OnDown) { P1_Left_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P1_Left_IsDown = newVal; } else { P1_Left_OnUp = newVal; } } else if (input == ServiceLocator.Inputs.Right) { if (state == ServiceLocator.InputStates.OnDown) { P1_Right_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P1_Right_IsDown = newVal; } else { P1_Right_OnUp = newVal; } } else if (input == ServiceLocator.Inputs.Use) { if (state == ServiceLocator.InputStates.OnDown) { P1_Use_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P1_Use_IsDown = newVal; } else { P1_Use_OnUp = newVal; } } else if (input == ServiceLocator.Inputs.Grab) { if (state == ServiceLocator.InputStates.OnDown) { P1_Grab_OnDown = newVal; } else if (state == ServiceLocator.InputStates.Down) { P1_Grab_IsDown = newVal; } else { P1_Grab_OnUp = newVal; } } } }
private void _ParseInteractionCommands(ServiceLocator.ID id) { if (id == ServiceLocator.ID.p0) { Debug.Assert(_objIntModel.p0_InteractableInterested.cat == ServiceLocator.ThingCategory.Equipment || _objIntModel.p0_InteractableInterested.cat == ServiceLocator.ThingCategory.Stations, "Attempting to parse menu for command-less interactiveCategory"); if (_objIntModel.p0_InteractableInterested.cat == ServiceLocator.ThingCategory.Equipment) { //Debug.Log("ControllerMenuEqpt in the equipment track"); Equipment_Base e = _objIntModel.p0_InteractableInterested as Equipment_Base; if (e != null) { //Debug.Log(this.GetType().ToString() + " identified as eqpt"); Dictionary <Command, CommandReferences> commandDict = new Dictionary <Command, CommandReferences>(); Dictionary <int, Command> seqDict = new Dictionary <int, Command>(); for (int i = 0; i < e.possibleCommands.Length; i++) { Debug.Log(this.GetType().ToString() + " in the for loop. possiblecommands length is " + e.possibleCommands.Length + "."); bool commandPermissible = false; if (_ReqdReagentConditionsMet(id, e, e.possibleCommands[i]) && _ReqdConsumablesPresent(id, e.possibleCommands[i]) && _IntendedTargetPresent(id, e, e.possibleCommands[i]) && _SpecialConditions(id, e, e.possibleCommands[i])) { commandPermissible = true; Debug.Log("Command is permissible"); } if (commandPermissible) { CommandReferences cRef = ScriptableObject.Instantiate <CommandReferences>(Resources.Load <CommandReferences>("CommandReference/CommandReference")); _StoreConsumablesRefs(id, cRef, e.possibleCommands[i]); _StoreReagentsRefs(id, e, cRef, e.possibleCommands[i]); _StoreTargetRefs(id, e, cRef, e.possibleCommands[i]); Debug.Log("CHecking if CREF EXISTS?!?!?!? " + cRef.target.ToString()); commandDict.Add(e.possibleCommands[i], cRef); seqDict.Add(seqDict.Count, e.possibleCommands[i]); } } //Debug.Log("SeqDict count is " + seqDict.Count); Command cancel = Resources.Load <Command>("Command/ExitMenu"); //Debug.Log(cancel.name); CommandReferences cancelCRef = ScriptableObject.Instantiate(Resources.Load <CommandReferences>("CommandReference/CommandReference")); commandDict.Add(cancel, cancelCRef); //Debug.Log("SeqDict count is " + seqDict.Count); seqDict.Add(seqDict.Count, cancel); //Debug.Log("SeqDict count is " + seqDict.Count); //Debug.Log(commandDict.Count + " " + seqDict.Count); //Debug.Log("Reagent Refs has :" + cRef.reagentRefs.Count); _eqptMenuModel.SetCommands(id, e, commandDict, seqDict); } } else if (_objIntModel.p0_InteractableInterested.cat == ServiceLocator.ThingCategory.Stations) { //Stn code } } else { //Mirror for p1 } }