panta
New vMember
Posts: 5
|
Post by panta on Jul 5, 2018 6:25:09 GMT
Can anyone help me? I want to add some waiting time before onDead trigger start running, I mean i want to add waiting time a few seconds before enemy set active an object after he die. Im a nub and iam svcks at programming :(
*sorry for my bad english
|
|
|
Post by Jader on Jul 5, 2018 11:12:40 GMT
Hi,
Can't test now, but I think thats work.
Just assign this to enemy and call the Death function on the onDead event, set the delay time and object to activate in the variables.
using UnityEngine; using System.Collections;
public class example : MonoBehaviour{ public float delayTime = 1.0f; public GameObject objectToActive;
public void Death(){
if (objectToActive != null) StartCoroutine(delayedDeath());
}
IEnumerator delayedDeath() {
yield return new WaitForSeconds(delayTime); objectToActive.SetActive(true);
} }
|
|
|
Post by Invector on Jul 5, 2018 18:33:12 GMT
You can also use the script vEventsWithDelay, I believe it's already in the project on the latest update... if not, send me your invoice number on a private message so I can send you the script.
|
|