public void OnTriggerStay(Collider other) { if (IsServer) { if (other.transform.root.CompareTag("item")) { recipeScript = other.transform.root.GetComponent <RecipeScript>(); if (recipeScript != null) { if (!recipeScript.isBeingHeld) { Transform temp = other.transform.root; //recipeScript = temp.GetComponent<RecipeScript>(); temp.position = placement.position; temp.rotation = placement.rotation; netTransformTemp = temp.GetComponent <NetwrokTransform>(); netTransformTemp.SetPos(placement.position); netTransformTemp.SetRot(placement.rotation.eulerAngles); // no update sent?? temp.SetParent(this.transform); } } //Debug.Log("cup on"); } } }
public void OnTriggerEnter(Collider other) { if (IsServer) { Transform temp = other.transform.root; if (temp.CompareTag("item")) { otherRecipeScript = temp.GetComponent <RecipeScript>(); if (otherRecipeScript != null) { recipeScript.AddAction("ADD", otherRecipeScript.ingredientName); if (!(hit.collider.name == "coffee" || hit.collider.name == "cup")) { int otherNetId = temp.GetComponent <NetworkID>().NetId; MyCore.NetDestroyObject(otherNetId); } //coffeeStuff.position = Vector3.Lerp(coffeeStuff.position, max.position, 0.01f); SendUpdate("A", "X"); } //Debug.Log("cup on"); } //Debug.Log(temp.name); } }
/* * public void OnTriggerEnter(Collider other) * { * if (IsServer) * { * Transform temp = other.transform.root; * * if (other.name == "egg") * { * otherRecipeScript = temp.GetComponent<RecipeScript>(); * if (otherRecipeScript != null) * { * if (!otherRecipeScript.isBeingHeld) * { * recipeScript.AddAction("BREAK", otherRecipeScript.ingredientName); * * //if (!(hit.collider.name == "coffee" || hit.collider.name == "cup")) * //{ * * MyCore.NetCreateObject(19, NetId, spawnPos.position); //fryed egg * * int otherNetId = temp.GetComponent<NetworkID>().NetId; * * MyCore.NetDestroyObject(otherNetId); * } * * //} * * } * //Debug.Log("cup on"); * } * //Debug.Log(temp.name); * } * } */ public void OnCollisionEnter(Collision other) { if (IsServer) { Transform temp = other.collider.transform.root; if (temp.name == "egg") { otherRecipeScript = temp.GetComponent <RecipeScript>(); if (otherRecipeScript != null) { if (!otherRecipeScript.isBeingHeld) { recipeScript.AddAction("BREAK", otherRecipeScript.ingredientName); //if (!(hit.collider.name == "coffee" || hit.collider.name == "cup")) //{ MyCore.NetCreateObject(19, NetId, spawnPos.position); //fryed egg int otherNetId = temp.GetComponent <NetworkID>().NetId; MyCore.NetDestroyObject(otherNetId); } //} } //Debug.Log("cup on"); } //Debug.Log(temp.name); } }
public override IEnumerator SlowUpdate() { if (IsServer) { } if (IsClient) { } while (IsServer) { Debug.DrawLine(spout.position, spout.position + -3f * Vector3.up, Color.red); if (Physics.Raycast(spout.position, -3f * Vector3.up, out hit)) { if (hit.transform.root.tag == "item") { recipeScript = hit.transform.root.GetComponent <RecipeScript>(); if (recipeScript != null) { recipeScript.AddAction("POUR", "TEA"); } if (hit.collider.name == "coffee" || hit.collider.name == "cup") { hit.collider.transform.root.GetComponent <CupNet>().AddHeight(); } } //Debug.Log(hit.collider.name); } yield return(new WaitForSeconds(MyCore.MasterTimer)); } //if being held play effect }
public override IEnumerator SlowUpdate() { if (IsServer) { recipeScript = GetComponent <RecipeScript>(); mask = LayerMask.GetMask("Kitchen"); reachedCond = true; } if (IsClient) { reachedCond = false; } while (IsServer && reachedCond) { //Raycast(Vector3 origin, Vector3 direction, out RaycastHit hitInfo, float maxDistance, int layerMask, Debug.DrawLine(rayPos.position, rayPos.position + 3f * Vector3.up, Color.red); if (Physics.Raycast(rayPos.position, Vector3.up, out hit, 3f, mask)) { if (hit.collider.name == "fryedEgg(Clone)") { hit.transform.SetParent(this.transform); recipeScript.AddAction("ADD", "FRYEDEGG"); reachedCond = false; } } yield return(new WaitForSeconds(MyCore.MasterTimer)); } }
public void OnTriggerStay(Collider other) { if (IsServer) { if (other.transform.root.CompareTag("item")) { otherRecipeScript = other.transform.root.GetComponent <RecipeScript>(); if (otherRecipeScript != null) { recipeScript.AppendHistory(otherRecipeScript.cookingHistory); } //Debug.Log("cup on"); } } }
public override IEnumerator SlowUpdate() { if (IsServer) { recipeScript = GetComponent <RecipeScript>(); } if (IsClient) { } //while (IsServer) //{ yield return(new WaitForSeconds(MyCore.MasterTimer)); //potentially slower //} }
public void OnTriggerStay(Collider other) { if (IsServer) { if (other.transform.root.CompareTag("item")) { recipeScript = other.transform.root.GetComponent <RecipeScript>(); if (recipeScript != null) { //apply knife func } //Debug.Log("cup on"); } } }
public override IEnumerator SlowUpdate() { if (IsServer) { recipeScript = GetComponent <RecipeScript>(); } if (IsClient) { this.transform.rotation = Quaternion.Euler(0f, 0f, 180f); min = coffeeStuff.position; } while (IsServer) { Debug.DrawLine(spout.position, spout.position + -3f * Vector3.up, Color.red); if (Physics.Raycast(spout.position, -3f * Vector3.up, out hit)) { if (hit.transform.root.tag == "item") { otherRecipeScript = hit.transform.root.GetComponent <RecipeScript>(); if (otherRecipeScript != null) { otherRecipeScript.AppendHistory(recipeScript.cookingHistory); } if (hit.collider.name == "coffee" || hit.collider.name == "cup") { SendUpdate("B", "X"); hit.collider.transform.root.GetComponent <CupNet>().AddHeight(); } } //Debug.Log(hit.collider.name); } yield return(new WaitForSeconds(MyCore.MasterTimer)); //potentially slower } }
public IEnumerator CheckBelow() { while (true) { Debug.DrawLine(spout.position, spout.position + -3f * Vector3.up, Color.red); if (Physics.Raycast(spout.position, -3f * Vector3.up, out hit)) { if (hit.transform.root.tag == "item") { recipeScript = hit.transform.root.GetComponent <RecipeScript>(); recipeScript.AddAction("POUR", "TEA"); if (hit.collider.name == "coffee") { hit.collider.transform.root.GetComponent <Coffee>().AddHeight(); } } //Debug.Log(hit.collider.name); } yield return(new WaitForSeconds(0.01f)); } }