-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bullet.cs
46 lines (36 loc) · 1.21 KB
/
Bullet.cs
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bullet : MonoBehaviour {
[SerializeField] Transform ChildBullet;
[SerializeField] int bulletSpeed;
bool esquerda;
private void Awake()
{
ChildBullet = transform.Find("New Sprite");
}
void Start () {
if (PlayerController.esquerda == true)
{
ChildBullet.transform.eulerAngles = new Vector3(
ChildBullet.transform.eulerAngles.x,
ChildBullet.transform.eulerAngles.y + 180,
ChildBullet.transform.eulerAngles.z
);
esquerda = true;
}
}
// Update is called once per frame
void Update()
{
if (esquerda == true)
{
transform.Rotate(0, bulletSpeed * Time.deltaTime, 0);
}
else
{
transform.Rotate(0, -bulletSpeed * Time.deltaTime, 0);
}
Destroy(this.gameObject, 2);
}
}