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); }
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); } } }
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; }
public virtual void Fire(MyShooter shooter) { }
public virtual void Discard(MyShooter shooter) { }