예제 #1
0
 public static void Fire(Vector3 pos)
 {
     if (bulet == null)
     {
         bulet = Resources.Load <Bulet>(ResPath);
     }
     Instantiate <Bulet>(bulet, pos, Quaternion.identity);
 }
예제 #2
0
    void Shoot()
    {
        GameObject bulletGO = (GameObject)Instantiate(bulletPrefab, firepoint.position, firepoint.rotation);

        Bulet bullet = bulletGO.GetComponent <Bulet>();

        if (bullet != null)
        {
            bullet.Seek(this.target);
        }

        Debug.Log("Shooot!");
    }
예제 #3
0
    private void Update()
    {
        float h = Input.GetAxis("Horizontal");

        if (h != 0)
        {
            t.Translate(new Vector3(h, 0, 0) * Time.deltaTime * Speed, Space.World);
            t.localEulerAngles = new Vector3(0, h * 30, 0);
        }
        else
        {
            t.localEulerAngles = new Vector3(0, 0, 0);
        }
        if (Input.GetAxis("Jump") != 0 && TimeGun <= 0)
        {
            Bulet.Fire(LeftGun.position);
            Bulet.Fire(RightGun.position);
            TimeGun = .25f;
        }
        TimeGun -= Time.deltaTime;
    }
예제 #4
0
 private void RemoveElement(Bulet bulet)
 {
     _bulets.Remove(bulet);
     _movables.Remove(bulet);
     _destructibles.Remove(bulet);
 }
예제 #5
0
 private void AddElement(Bulet bulet)
 {
     _bulets.Add(bulet);
     _movables.Add(bulet);
     _destructibles.Add(bulet);
 }