2024-11-04 05:20:09 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class AnimatoinManager : MonoBehaviour
|
|
|
|
{
|
|
|
|
|
|
|
|
public float time=0f;
|
2024-11-04 20:29:18 +08:00
|
|
|
private float yuntime = 0f;
|
2024-11-04 05:20:09 +08:00
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Playanim()
|
|
|
|
{
|
2024-11-16 18:38:34 +08:00
|
|
|
GameObject fi = Instantiate((GameObject)Resources.Load("fish_1"),this.gameObject.transform);
|
2024-11-04 05:20:09 +08:00
|
|
|
float x = Random.Range(-5, 5);
|
2024-11-16 18:38:34 +08:00
|
|
|
float y = Random.Range(-11,0);
|
2024-11-04 05:20:09 +08:00
|
|
|
fi.transform.position = new Vector3(x,y,0);
|
|
|
|
Destroy(fi, 2f);
|
|
|
|
}
|
|
|
|
|
2024-11-04 20:29:18 +08:00
|
|
|
private void Moveyunduo()
|
|
|
|
{
|
|
|
|
for (int i = 0; i < Random.Range(1, 4); i++)
|
|
|
|
{
|
2024-11-16 18:38:34 +08:00
|
|
|
GameObject fi = Instantiate(Resources.Load<GameObject>("yunduo" + Random.Range(1, 4)),this.gameObject.transform);
|
2024-11-25 17:58:55 +08:00
|
|
|
float x = Random.Range(-14, -10);
|
2024-11-25 14:35:52 +08:00
|
|
|
float y = Random.Range(-7,11);
|
2024-11-04 20:29:18 +08:00
|
|
|
fi.transform.position = new Vector3(x,y,0);
|
|
|
|
Destroy(fi,10f);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-11-04 05:20:09 +08:00
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
|
|
|
time += Time.deltaTime;
|
2024-11-04 20:29:18 +08:00
|
|
|
yuntime += Time.deltaTime;
|
2024-11-04 05:20:09 +08:00
|
|
|
if (time > 5f)
|
|
|
|
{
|
|
|
|
time = 0;
|
|
|
|
for (int i = 0; i < Random.Range(1,4); i++)
|
|
|
|
{
|
|
|
|
Playanim();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2024-11-04 20:29:18 +08:00
|
|
|
|
|
|
|
if (yuntime > 10f)
|
|
|
|
{
|
|
|
|
yuntime = 0;
|
|
|
|
Moveyunduo();
|
|
|
|
}
|
|
|
|
|
2024-11-04 05:20:09 +08:00
|
|
|
}
|
|
|
|
}
|