예제 #1
0
 void Awake()
 {
     nailBullet = nailPrefab.GetComponent <NailBullet>();
     if (nailBullet == null)
     {
         throw new UnassignedReferenceException("wrong type of bullet assigned to Pistol");
     }
 }
예제 #2
0
    public override void Attack()
    {
        if (automated || (equipped && !delayed))
        {
            //currently not being affected by players position
            NailBullet b = Instantiate(nailPrefab, bulletSpawn.position, bulletSpawn.rotation).GetComponent <NailBullet>();

            //**ADD CALCUATION FOR BULLET DIRECTION***
            if (pointingRight)
            {
                b.SetIntialVelocity(new Vector3(b.bulletSpeed, 0, 0));
            }
            else
            {
                b.SetIntialVelocity(new Vector3(b.bulletSpeed, 0, 0));
            }


            delayed = true;
            StartCoroutine(Delay(shotDelay));
        }
    }