Example #1
0
        public void RPCDie(Vector3 velocity, Vector3 raycasterPosition, Vector3 raycasterForward, float physicsForce, int killerID, int killerWeaponID)
        {
            if (ServerController.HasRoundEnded)
            {
                return;
            }

            PhotonPlayer killer    = PhotonPlayer.Find(killerID);
            GunInfo      killerGun = GameController.GetGun(killerWeaponID);

            health = 0;

            worldModel.Die(velocity);

            bool headshot = false;

            RaycastHit hit;

            if (Physics.Raycast(raycasterPosition, raycasterForward, out hit, float.MaxValue, GameController.Instance.afterKillFireLayers))
            {
                if (hit.transform.gameObject.layer == 30)
                {
                    headshot = (hit.transform.tag == "Head") && !killerGun.disableHeadshots;

                    Rigidbody rigid = hit.collider.attachedRigidbody;
                    rigid.AddForceAtPosition(raycasterForward * physicsForce, hit.point, ForceMode.Impulse);
                }
            }


            ServerController.OnKill(killer, killerGun, photonView.owner, headshot);
        }
Example #2
0
        public void RPCFire()
        {
            AudioClip clip = GameController.GetGun(currentGunID).fireSound;

            source.PlayOneShot(clip);

            worldModel.ShowMuzzle();
        }
Example #3
0
        public GunBase InstantiateGun(int ID)
        {
            GunInfo    gunInfo = GameController.GetGun(ID);
            GameObject go      = Instantiate(gunInfo.viewmodel) as GameObject;

            go.name = string.Format("VM_{0}", gunInfo.Name);

            go.transform.SetParent(mainGunsScript.transform, false);
            go.transform.localPosition = Vector3.zero;
            go.transform.localRotation = Quaternion.identity;
            go.transform.localScale    = Vector3.one;

            GunBase gun = go.GetComponent <GunBase>();

            gun.info = gunInfo;
            gun.main = mainGunsScript;

            CharacterCustomization customization = go.GetComponent <CharacterCustomization>();

            customization.StartUp();

            return(gun);
        }
Example #4
0
        public WorldModelGun InstantiateGun(int ID)
        {
            GunInfo    gunInfo = GameController.GetGun(ID);
            GameObject go      = Instantiate(gunInfo.worldmodel) as GameObject;

            go.name = string.Format("WM_{0}", gunInfo.Name);

            go.transform.SetParent(gunsParent.transform, false);
            go.transform.localPosition = Vector3.zero;
            go.transform.localRotation = Quaternion.identity;
            go.transform.localScale    = Vector3.one;

            WorldModelGun gun = go.GetComponent <WorldModelGun>();

            gun.info = gunInfo;
            gun.leftArmCharacterJoint.connectedBody  = torsoRigidbody;
            gun.rightArmCharacterJoint.connectedBody = torsoRigidbody;

            CharacterCustomization customization = go.GetComponent <CharacterCustomization>();

            customization.StartUp();

            return(gun);
        }