-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUpgradedTripleShot.cs
38 lines (36 loc) · 1.65 KB
/
UpgradedTripleShot.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class UpgradedTripleShot : PlayerAttack
{
public GameObject bulletPrefab;
public UpgradedTripleShot()
{
this.UISpriteName = "UIUpgradedTripleShot";
this.type = Type.Gun;
this.id = 4;
bulletPrefab = Resources.Load("PlayerBulletObject") as GameObject;
}
public override void Attack(Transform transform)
{
Vector3 leftBulletPos = new Vector3(transform.position.x - 0.233f, transform.position.y + 0.371f, transform.position.z);
Vector3 rightBulletPos = new Vector3(transform.position.x + 0.233f, transform.position.y + 0.371f, transform.position.z);
Vector3 middleBulletPos = new Vector3(transform.position.x, transform.position.y + .5f, transform.position.z);
GameObject go1 = GameObject.Instantiate(bulletPrefab, leftBulletPos, Quaternion.identity);
GameObject go2 = GameObject.Instantiate(bulletPrefab, rightBulletPos, Quaternion.identity);
GameObject go3 = GameObject.Instantiate(bulletPrefab, middleBulletPos, Quaternion.identity);
PlayerBullet bullet1 = go1.GetComponent<PlayerBullet>();
PlayerBullet bullet2 = go2.GetComponent<PlayerBullet>();
PlayerBullet bullet3 = go3.GetComponent<PlayerBullet>();
bullet1.targetVector = new Vector3(0, 1, 0);
bullet2.targetVector = new Vector3(0, 1, 0);
bullet3.targetVector = new Vector3(0, 1, 0);
bullet1.speed = 200;
bullet2.speed = 200;
bullet3.speed = 200;
bullet1.damage = 10;
bullet2.damage = 10;
bullet3.damage = 30;
}
}