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 override void CheckInteract(GameObject obj, Vector3 point, StateMachine checkMachine) { if (obj == null) { canInteract = false; return; } TreeMachine tm = obj.GetComponentInParent <TreeMachine> (); if (tm != null) { tm.Interact(obj, point); canInteract = tm.CanChop(); return; } canInteract = false; }
public override void Tap(GameObject obj, Vector3 point, StateMachine checkMachine) { if (obj == null) { return; } TreeMachine tm = obj.GetComponentInParent <TreeMachine> (); if (tm != null) { canInteract = tm.CanChop(); if (tm.CanChop()) { tm.timer.StartTimer(tm.chopTime, true, InputMachine.instance.reticle.getTimerLocation(), numbers: false); } return; } }
public override void InstanceInteract(GameObject obj, Vector3 point, StateMachine checkMachine) { TreeMachine tm = checkMachine.GetComponentInParent <TreeMachine> (); if (tm.timer.CheckTimer(true)) { if (checkMachine.phase < checkMachine.transform.localScale.x * 10) { checkMachine.phase++; PlayerMachine.instance.AddResource("wood", 1); } else { checkMachine.UpdateState(StateMaster.instance.treeFallen, checkMachine); PlayerMachine.instance.AddResource("wood", 1); return; } tm.timer.StartTimer(tm.chopTime, true, InputMachine.instance.reticle.getTimerLocation(), numbers: false); } else if (tm.timer.CheckTimer(false)) { tm.timer.StartTimer(tm.chopTime, true, InputMachine.instance.reticle.getTimerLocation(), numbers: false); } }
protected void StartWith(TreeMachine.IWorkflow wf, TData data) { Machine = new TreeMachine(data, null, this); Machine.Run(wf); }