public void Setup() { StateMaster.instance = this; timer = (GameObject)Resources.Load <GameObject> ("Timer"); plantDry = gameObject.AddComponent <Plant_Dry>(); plantFallow = gameObject.AddComponent <Plant_Fallow>(); plantGrowing = gameObject.AddComponent <Plant_Growing>(); plantGrown = gameObject.AddComponent <Plant_Grown>(); plantPlanted = gameObject.AddComponent <Plant_Planted>(); plantWithered = gameObject.AddComponent <Plant_Withered>(); treeGrowing = gameObject.AddComponent <Tree_Growing>(); treeFallen = gameObject.AddComponent <Tree_Fallen>(); animalCrying = gameObject.AddComponent <Animal_Crying>(); animalFollowing = gameObject.AddComponent <Animal_Following>(); animalRoaming = gameObject.AddComponent <Animal_Roaming>(); animalRunningAway = gameObject.AddComponent <Animal_RunningAway>(); inputUI = gameObject.AddComponent <Input_UI>(); inputTeleport = gameObject.AddComponent <Input_Teleport>(); inputInteract = gameObject.AddComponent <Input_Interact>(); inputPickUp = gameObject.AddComponent <Input_PickUp>(); inputInspect = gameObject.AddComponent <Input_Inspect>(); inputChop = gameObject.AddComponent <Input_Chop>(); inputGather = gameObject.AddComponent <Input_Gather>(); houseOpen = gameObject.AddComponent <House_Open> (); }
public void SetHand(InputMachine setValue) { if (currentInteractionState == setValue) { return; } if (handInstance != null) { Destroy(handInstance.gameObject); } currentInteractionState = setValue; if (is_right) { GameObject newHand = (GameObject)GameObject.Instantiate(setValue.setRightHand, transform); newHand.transform.localPosition = Vector3.zero; newHand.transform.rotation = InputMachine.instance.transform.rotation; handInstance = newHand.GetComponent <HandInstance> (); } else { GameObject newHand = (GameObject)GameObject.Instantiate(setValue.setLeftHand, transform); newHand.transform.localPosition = Vector3.zero; newHand.transform.localScale = new Vector3(-1, 1, 1); newHand.transform.rotation = InputMachine.instance.transform.rotation; handInstance = newHand.GetComponent <HandInstance> (); } }
InputMachine GetSelected() { InputMachine newAction = null; if (currentSelected == null) { return(newAction); } return(newAction); }
public void SetReticle(InputMachine setValue) { if (currentInteractionState == setValue && reticleInstance != null) { return; } left.SetHand(setValue); right.SetHand(setValue); if (reticleInstance != null) { Destroy(reticleInstance.gameObject); } currentInteractionState = setValue; GameObject newHand = (GameObject)GameObject.Instantiate(setValue.setReticle, transform); newHand.transform.localPosition = Vector3.zero; reticleInstance = newHand.GetComponent <ReticleInstance> (); }
public override void InstanceInitiate(StateMachine checkMachine) { InputMachine.instance = this; if (thisCamera == null) { thisCamera = GetComponent <Camera> (); } OVRTouchpad.Create(); swipeUp = StateMaster.instance.inputUI; swipeDown = StateMaster.instance.inputInteract; swipeForward = StateMaster.instance.inputTeleport; swipeBack = StateMaster.instance.inputInteract; UpdateState(StateMaster.instance.inputTeleport, this); EventSystem.current.sendNavigationEvents = false; thisCamera.layerCullSpherical = true; Application.targetFrameRate = 240; HOTween.To(blackoutDip, 5f, new TweenParms().Prop("color", new Color(0f, 0f, 0f, 0f))); StartCoroutine("InitialCheckObjects"); }