コード例 #1
0
        public override bool Shoot()
        {
            if (!CanShoot())
            {
                return(false);
            }

            SpaceObject so = parent.so;

            ammo -= 1.0f;
            so.ApplyForce(parent.transform.forward * recoil);

            GameObject  bgo = (GameObject)Instantiate(projectile, parent.transform.position, parent.transform.rotation);
            SpaceObject bso = bgo.GetComponent <SpaceObject>();

            bso.spd      = so.spd - parent.transform.forward * so.spd.magnitude * 0.1f;
            bso.universe = so.universe;
            bso.GetComponent <Projectile>().parent = parent;
            so.universe.AddObject(bso);

            delaycounter = delay;

            return(true);
        }