void OnTriggerEnter(Collider collider) { //Debug.Log (this.tag); if (currentState == tool_state.ONGround && collider.name == "dwarf_07") { GameObject.FindWithTag("hammer_in_hand").GetComponent <MeshRenderer> ().enabled = false; GameObject.FindWithTag("axe_in_hand").GetComponent <MeshRenderer> ().enabled = false; GameObject.FindWithTag("Tail").GetComponent <MeshRenderer> ().enabled = false; Debug.Log("shoun on gound"); if (this.tag == "hammer_in_gound") { var gameobj1 = GameObject.FindWithTag("Partical_sys1"); var partical = gameobj1.transform.GetComponent <ParticleSystem> (); partical.enableEmission = false; var gameObj2 = GameObject.FindWithTag("hammer_in_hand"); gameObj2.GetComponent <MeshRenderer> ().enabled = true; // GameObject.FindWithTag ("hammer_in_gound").SetActive (false); disappear(); playerstate.setToolState((int)playerStateLinster.enum_tool_state.Hammer); GameObject.FindWithTag("Tail").GetComponent <MeshRenderer> ().enabled = false; } else if (this.tag == "axe_in_gound") { var gameobj1 = GameObject.FindWithTag("Partical_sys2"); var partical = gameobj1.transform.GetComponent <ParticleSystem> (); partical.enableEmission = false; var gameObj2 = GameObject.FindWithTag("axe_in_hand"); gameObj2.GetComponent <MeshRenderer> ().enabled = true; //GameObject.FindWithTag ("axe_in_gound").SetActive (false); disappear(); playerstate.setToolState((int)playerStateLinster.enum_tool_state.Axe); GameObject.FindWithTag("Tail").GetComponent <MeshRenderer> ().enabled = true; } currentState = tool_state.Unvisible; } if (currentState == tool_state.Flying) { if (collider.name == "skeleton_archer") { rolepropertyitem.subXue(); } if (collider.name == "bruce") { bossstate.subxue(); } } }
void Start() { scriptobj = GameObject.FindWithTag("scriptObj").transform; playerstate = scriptobj.GetComponent <playerStateLinster> (); playerstate.setToolState(0); player = GameObject.FindWithTag("Player").transform; }