예제 #1
0
    public override void Fire(MyShooter shooter)
    {
        if (bullet == null)
        {
            bullet = Resources.Load <GameObject>("Prefabs/MyBullet2");
        }
        base.Fire(shooter);
        GameObject newObj = GameObject.Instantiate(bullet);

        newObj.transform.position = shooter.shootPoint.position;
        newObj.GetComponent <Rigidbody>().AddForce(shooter.myCamera.transform.forward * power);
    }
예제 #2
0
 private void OnCollisionEnter(Collision collision)
 {
     // 플레이어에게 웨폰을 증정하고 기존 웨폰을 해제 시킨다.
     if (collision.gameObject.tag == "Player")
     {
         MyShooter shooter = collision.gameObject.GetComponent <MyShooter>();
         if (shooter != null)
         {
             shooter.myWeapon.Discard(shooter);
             shooter.myWeapon = CreateWeapon();
             Destroy(gameObject);
         }
     }
 }
예제 #3
0
    public override void Discard(MyShooter shooter)
    {
        base.Discard(shooter);
        GameObject weapon = Resources.Load <GameObject>("Prefabs/WeaponItem");

        weapon = GameObject.Instantiate(weapon);
        WeaponItem wi = weapon.GetComponent <WeaponItem>();

        if (wi)
        {
            wi.SetWeaponCode(2);
        }
        weapon.transform.position = shooter.transform.position +
                                    shooter.transform.up * discardPosition;
    }
예제 #4
0
 public virtual void Fire(MyShooter shooter)
 {
 }
예제 #5
0
 public virtual void Discard(MyShooter shooter)
 {
 }