private void BearingMadeInteractions(Clicker clicker) { if(clicker.name == "Bearing") { state = State.RaftDeflated; gameGUI.message = "Almost there. Now just fill up the raft with air and sail forward"; } }
private void PumpClickedInteractions(Clicker clicker) { if(clicker.gameObject == raft.gameObject) { gameGUI.message = "A closer inspection reveals that the ball bearing assembly (that keeps the air from going out) " + "has been damaged. You will need to create one. Perhaps you can make use of the items available on " + "the table"; state = State.RaftChecked; bearingGame.Initialize(); } }
public override void Interact(Clicker clicker) { base.Interact (clicker); if(clicker as Shard) { RaycastHit info; beaker.collider.enabled = true; if(beaker.collider.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out info, Camera.main.farClipPlane)) { if(!selectedShards.Contains(clicker as Shard)) selectedShards.Add (clicker as Shard); clicker.transform.position = Camera.main.ScreenPointToRay(Input.mousePosition).GetPoint(info.distance+0.14f); } else { selectedShards.Remove(clicker as Shard); MoveToReset component = clicker.gameObject.AddComponent<MoveToReset>(); component.end = clicker.startPosition; component.start = clicker.transform.position; component.time = 0.5f; } beaker.collider.enabled = false; currentVolume = 0; foreach(Shard shard in selectedShards) currentVolume += shard.volume; beaker.transform.Find("Water").localScale = new Vector3 (1,1, Mathf.Min (1+currentVolume/20f, 2)); } else if (clicker == furnace) { if(currentVolume == correctVolume) { Item ball = Instantiate(ballBearing, Vector3.zero, Quaternion.identity) as Item; ball.name = "Bearing"; parentManager.Interact(ball); furnace.manager = null; foreach(Shard shard in shards) Destroy (shard.gameObject); Destroy (this); } else { GameObject.FindGameObjectWithTag("GameController").GetComponent<GameGUI>().message = "Not the correct volume. Try again."; AudioSource.PlayClipAtPoint(wrongClip, beaker.transform.position); } } }
public override void Interact(Clicker clicker) { base.Interact (clicker); if(clicker as Shard) { RaycastHit info; beaker.collider.enabled = true; if(beaker.collider.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out info, Camera.main.farClipPlane)) { if(!selectedShards.Contains(clicker as Shard)) selectedShards.Add (clicker as Shard); clicker.transform.position = Camera.main.ScreenPointToRay(Input.mousePosition).GetPoint(info.distance+0.14f); if(!learned) { LearnedItem item = Instantiate(learnedItem) as LearnedItem; item.message = "Eureka!\n\nYou just learned Archimedes' principle for displacement of volume.\n\n" + "Archimedes was a Greek philosophist who lived during the third century BCE. Perhaps he is best known " + "for proposing a method for computing the volume of arbitrarily shaped bodies through displacement. In this " + "experiment, observe how the water level changes as you put more items into the flask."; GameObject.FindGameObjectWithTag("GameController").GetComponent<InventoryManager>().Interact(item); learned = true; AudioSource.PlayClipAtPoint(successClip,beaker.transform.position); } } else { selectedShards.Remove(clicker as Shard); MoveToReset component = clicker.gameObject.AddComponent<MoveToReset>(); component.end = clicker.startPosition; component.start = clicker.transform.position; component.time = 0.5f; } beaker.collider.enabled = false; currentVolume = 0; foreach(Shard shard in selectedShards) currentVolume += shard.volume; beaker.transform.Find("Water").localScale = new Vector3 (1,1, 1+currentVolume/20f); } }
public virtual void Interact(Clicker clicker) { }
private void StartInteractions(Clicker clicker) { }
private void FinishInteractions(Clicker clicker) { }
public override void Interact(Clicker clicker) { interactions[state](clicker); }
private void RaftCheckedInteractions(Clicker clicker) { if(clicker.name == "Bearing") { state = State.BearingMade; (clicker as Item).target = raft.collider; (clicker as Item).manager = this; AudioSource.PlayClipAtPoint(foundClip, raft.transform.position); GameObject.FindGameObjectWithTag("GameController").GetComponent<InventoryManager>().Interact(clicker as Item); gameGUI.message = "Well done!\n" + "You managed to create a ball bearing of the appropriate size. The shiny new ball has been added to your inventory. " + "We should be able to fix the raft using it."; } }
private void StartInteractions(Clicker clicker) { if(clicker.gameObject == raft.gameObject) { state = State.RaftClicked; gameGUI.message = "It appears the raft has lost much of its air. There is a pump nearby. Maybe you can pump some air in."; } }
private void RaftInflatedInteractions(Clicker clicker) { if(clicker.gameObject == raft.gameObject) { GameObject.FindGameObjectWithTag("Player").transform.position = targetLocation.position; GameObject.FindGameObjectWithTag("Player").transform.rotation = targetLocation.rotation; gameGUI.message = "Quest completed! You were able to successfully apply Archimedes' principle to fix your raft. Great job.\n\n<-- End of Game -->"; state = State.Finish; AudioSource.PlayClipAtPoint(successClip, targetLocation.position); } }
private void RaftDeflatedInteractions(Clicker clicker) { if(clicker.gameObject == pump.gameObject) { pump.animation.Play ("Pump"); AnimateDelayed component = raft.gameObject.AddComponent<AnimateDelayed>(); component.time = 1; component.clip = "Inflate"; state = State.RaftInflated; AudioSource.PlayClipAtPoint(leverClip, pump.transform.position); } }
private void RaftClickedInteractions(Clicker clicker) { if(clicker.gameObject == pump.gameObject) { pump.gameObject.animation.Play ("Pump"); AnimateDelayed component = raft.gameObject.AddComponent<AnimateDelayed>(); component.time = 1; component.clip = "InflateDeflate"; gameGUI.message = "Awesome! The pump inflated the raft, but it has soon deflated again. Perhaps something is wrong with the raft"; state = State.PumpClicked; AudioSource.PlayClipAtPoint(leverClip, pump.transform.position); } }