-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemyBallonSpawn.cs
More file actions
49 lines (43 loc) · 1.15 KB
/
EnemyBallonSpawn.cs
File metadata and controls
49 lines (43 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyBallonSpawn : MonoBehaviour
{
public GameObject Ballon;
public int BallonFrameCount;
private int TimeClone;
void Update()
{
TimeClone = Time.frameCount;
Debug.Log(TimeClone);
if (TimeClone % BallonFrameCount == 0)
{
CloneBallon(Ballon);
}
}
/*void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("EnemyBallon"))
{
Destroy(collision.gameObject);
}
}*/
void CloneBallon(GameObject gameObject)
{
bool JuiceCloned = false;
while (!JuiceCloned)
{
Vector3 pos = new Vector3(-21.99f, 12.87f, -11.68f);
if ((pos - transform.position).magnitude < 3)
{
continue;
}
else
{
PlayerMovment.speed = 10;
Instantiate(gameObject, pos, gameObject.transform.rotation);
JuiceCloned = true;
}
}
}
}