public void AddScore(int worth, GameObject obj) { if (this.isServer) { score += worth; Rpc_SyncScore(score); Destroy(obj); if (score >= winningScore) { print("Rabbits Win"); isWin = true; CountRabbit cr = (CountRabbit)textMeshP.GetComponent <CountRabbit>(); cr.rabbitWin(); //indText.rabbitWin(); //Rpc_SyncGameEnd(); //Time.timeScale = 0; } } }
}//update //We can use trigger or Collision void OnTriggerEnter(Collider col) { //col.GetComponent<Collider>().enabled = false; if (col.gameObject.tag == "net" && !this.caught){ print("Caught rabbit w net"); //fpc.canMove = false; //indText.Caught(); caught = true; UnityStandardAssets.Characters.FirstPerson.FirstPersonController fpc = (UnityStandardAssets.Characters.FirstPerson.FirstPersonController) this.gameObject.GetComponent(typeof(UnityStandardAssets.Characters.FirstPerson.FirstPersonController)); forceDrop(); fpc.Cmd_setCanMove(); CountRabbit cr = (CountRabbit) textMeshP.GetComponent<CountRabbit>(); cr.KillRabbit(); StartCoroutine(ExecuteAfterTime(2)); //SteamVR_Controller.Input(0).TriggerHapticPulse(500); //this.gameObject.SendMessage("setCanMove"); } //col.GetComponent<Collider>().enabled = true; }