V
V
Vladimir2021-08-30 20:53:13
Unity
Vladimir, 2021-08-30 20:53:13

How to make a sequence of actions for a prefab?

Please tell me how you can do a sequence of actions for each of the prefabs, as soon as it reaches a certain point. For example, initially, many little people are flying down, but as soon as one of them reaches a certain point, the little man should start moving to the right, while such a change in direction should not affect the rest of the little men who are still in flight. What is responsible for this? how can this be done?
Added:
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.tag == "Floor")
{
Heart.hearts--;
if (Heart.hearts <= 0)
{
SceneManager.LoadScene(2);
}

}
if (collision.gameObject.tag == "Bullet")
{
ManHit();
Destroy(collision.gameObject);

}
}
private void FixedUpdate()
{
Man.transform.Translate(0, -speed * Time.deltaTime, 0);
}

How to change the direction of movement when triggered with "Floor" ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-08-30
@tentrun

See how you did them. If this is some sheet or collection, then select the one you need. Maybe redefining the behavior would help. You didn't even provide a code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question