Exemplo n.º 1
0
        public void Shoot_RPC(Vector3 position, Quaternion rotation, int ID)
        {
            Photon.Pun.PhotonView character = Photon.Pun.PhotonView.Find(ID);

            BulletController bullet = BulletsPool.Pool.GetBullet();
            GunStats         gstats = getGunStats();

            bullet.Initilize(position, rotation, gstats.power, gstats.Damage, gstats.lifeTime, character.IsMine);

            shotSource.PlayOneShot(shotNoise, GameConfiguration.EffectsLevel);
            muzzle.gameObject.SetActive(true);
            muzzle.Play(true);

            float max = getGunStats().MaxRecoil;

            recoilTarget.x += Random.Range(-max, max);
            recoilTarget.y += Random.Range(-max, max);
            recoilTarget.z += Random.Range(-max, max);


            ActualAmmo--;
            ShootedBullets++;

            bullet.gameObject.SetActive(true);
        }
Exemplo n.º 2
0
        public GunStats getGunStats()
        {
            if (Stats is GunStats)
            {
                return(Stats as GunStats);
            }
            GunStats defect = new GunStats();

            Stats = defect;
            return(defect);
        }