private void OnTriggerExit(Collider other) { if (other.gameObject.tag == "Player") { //QUAND ON SORT DE LA ZONE EN VOLANT UN OBJET PlayerManager player = other.gameObject.GetComponent <PlayerManager>(); if (player.IsBringingObject()) { BringObject concernedObj = player.IsBringingObject(); if (concernedObj.GetComponent <InteractObject>().CanTakeObject) { return; } CheckStealObject(concernedObj, true); if (concernedObj.GetOwner() == characterOwner) { objectsInZone.Remove(concernedObj.gameObject); } } else if (player.IsBringingTool()) { ToolObject tool = player.IsBringingTool(); if (tool.GetComponent <InteractObject>().CanTakeObject) { return; } CheckStealObject(tool, true); if (tool.GetOwner() == characterOwner) { objectsInZone.Remove(tool.gameObject); } } } }
protected override void OnCollisionEnter(Collision collision) { //quand l'objet est touché par un autre objet lancé if (collision.gameObject.tag == "BringObject") { BringObject otherObject = collision.gameObject.GetComponent <BringObject>(); if (otherObject.GetObjectReglages().IsBreakingThings&& otherObject.IsLaunch) { StartBreaking(); } } //quand on lance l'objet if (!IsLaunch) { return; } StartBreaking(); if (collision.gameObject.tag == "PNJ") { PnjManager pnj = collision.gameObject.GetComponent <PnjManager>(); StartHurting(pnj); } else if (collision.gameObject.name == "Terrain") { StartCoroutine(StopOnGround()); } }
public void TriggerEffect(GameObject orb) { triggerCameraOnStele.SetActive(false); BringObject orbBringing = orb.GetComponent <BringObject>(); orb.transform.parent = orbPosition; orb.transform.position = orbPosition.position; orbBringing.CanInteract = false; orb.GetComponent <Rigidbody>().useGravity = false; orb.GetComponent <Rigidbody>().mass = 1; orb.GetComponent <Rigidbody>().isKinematic = true; // orb.GetComponent<S> GetComponentInParent <Animator>().SetBool("Glow", true); AkSoundEngine.PostEvent("ENV_orb_activated_play", gameObject); ceremonieParticle.SetActive(true); GameManager.Instance.EndGame(orb); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "PNJ" && other.gameObject.GetComponent <PnjManager>().GetCharacterType() == characterOwner) { PnjCheckStealedObjects(); } else if (other.gameObject.tag == "Player") { PlayerManager player = other.gameObject.GetComponent <PlayerManager>(); if (player.IsBringingObject()) { //SI JE REVIENS DANS LA ZONE AVEC UN OBJET DU PERSO BringObject concernedObj = player.IsBringingObject(); // CheckEventObject(concernedObj); if (concernedObj.GetComponent <InteractObject>().CanTakeObject) { return; } CheckStealObject(concernedObj, false); if (concernedObj.GetOwner() == characterOwner) { objectsInZone.Add(concernedObj.gameObject); } } else if (player.IsBringingTool()) { ToolObject tool = player.IsBringingTool(); // CheckEventObject(tool); if (tool.GetComponent <InteractObject>().CanTakeObject) { return; } CheckStealObject(tool, false); if (tool.GetOwner() == characterOwner) { objectsInZone.Add(tool.gameObject); } } } }
protected virtual void OnCollisionEnter(Collision collision) { //quand l'objet est touché par un autre objet lancé if ((collision.gameObject.tag == "BringObject") || (collision.gameObject.tag == "InteractToolObject")) { BringObject otherObject = collision.gameObject.GetComponent <BringObject>(); if (otherObject.GetObjectReglages().IsBreakingThings&& otherObject.IsLaunch) { StartBreaking(); } } //quand on lance l'objet if (!IsLaunch) { return; } StartBreaking(); if (collision.gameObject.tag == "PNJ") { PnjManager pnj = collision.gameObject.GetComponent <PnjManager>(); StartHurting(pnj); } }
protected void OnTriggerEnter(Collider collision) { if (!IsUsingObject) { return; } //quand l'objet est touché par un autre objet lancé if (collision.gameObject.tag == "BringObject") { BringObject otherObject = collision.gameObject.GetComponent <BringObject>(); if (reglages.IsBreakingThings && otherObject.GetReglages().IsBreaking) { otherObject.StartBreaking(); } } else if (collision.gameObject.tag == "InteractToolObject" && collision.gameObject.GetComponent <InteractObject>().objectType == ObjectType.MusicStone) { collision.gameObject.GetComponent <MusicStone>().BreakMusicStone(); } else if (collision.gameObject.tag == "Tree") { if (collision.GetComponentInChildren <TreeStickSpawner>() != null) { collision.GetComponentInChildren <TreeStickSpawner>().SpawnStick(); } } StartBreaking(); if (collision.gameObject.tag == "PNJ") { PnjManager pnj = collision.gameObject.GetComponent <PnjManager>(); StartHurting(pnj); } if ((collision.gameObject.name != "Terrain") && (collision.gameObject.tag != "Player") && (collision.gameObject.tag != "TOOL") && (collision.gameObject.tag != "Patoune")) { EndUseObjectOnCollision(); } }
public void SetToolObject(ToolObject tool) { bringObject = null; toolObject = tool; }
public void SetBringingObject(BringObject obj) { toolObject = null; bringObject = obj; }