Exemplo n.º 1
0
    private void Start()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        // Settings for the pistol
        WeaponList[0]                      = new WeaponClass();
        WeaponList[0].Muzzle               = Muzzle;
        WeaponList[0].ShootSound           = ShootSound;
        WeaponList[0].fireArm              = true;
        WeaponList[0].fireRate             = 0.12f;
        WeaponList[0].gunRage              = 1000;
        WeaponList[0].recoilUp             = 0f;
        WeaponList[0].maxMagazine          = 3;
        WeaponList[0].maxBulletPerMagazine = 10;
        WeaponList[0].power                = 100;
        CurrentWeapon                      = WeaponList[0];

        // Correction value for the startrotation
        startRotation += transform.localEulerAngles.y;

        // The player always starts with full ammo
        foreach (WeaponClass weapon in WeaponList)
        {
            weapon.magazineLeft = weapon.maxMagazine;
            weapon.bulletLeft   = weapon.maxBulletPerMagazine;
        }

        // Due to the ragdoll, we need access to some scripts and components, when the player respawn
        Script_CharacterMotor = (VRCharacterMotor)GetComponent("VRCharacterMotor");
        Character_Controller  = (CharacterController)GetComponent("CharacterController");
        Script_MouseLook      = (MouseLook)Neck.GetComponent("MouseLook");
        DeadCamera.SetActive(false);
        DeadCamera3D.SetActive(false);
        Script_CharacterMotor.enabled      = true;
        GetComponent <Animation>().enabled = true;
        Character_Controller.enabled       = true;
        isDead = false;

        switch (movmentType)
        {
        case 1:                 // FPS - Virtual reality mode for goggles like Oculus Rift or Durovis Dive
            Camera3D.SetActive(true);
            CameraStandard.SetActive(false);
            Script_MouseLook.enabled = true;
            inputRotX = "Rot X";
            inputRotY = "Rot Y";
            minViewX  = -10f;
            maxViewX  = 10f;
            minViewY  = -10f;
            maxViewY  = 10f;
            break;

        case 2:                 // FPS - Realistic(Still a problem when you rotate to fast)
            Camera3D.SetActive(false);
            CameraStandard.SetActive(true);
            Script_MouseLook.enabled = false;
            inputRotX = "Mouse X";
            inputRotY = "Mouse Y";
            minViewX  = -20f;
            maxViewX  = 20f;
            minViewY  = -10f;
            maxViewY  = 10f;
            break;

        case 3:                 // FPS - Standard
            Camera3D.SetActive(false);
            CameraStandard.SetActive(true);
            Script_MouseLook.enabled = false;
            inputRotX = "Mouse X";
            inputRotY = "Mouse Y";
            minViewX  = 0f;
            maxViewX  = 0f;
            minViewY  = 0f;
            maxViewY  = 0f;
            break;
        }
    }
Exemplo n.º 2
0
 // Use this for initialization
 void Awake()
 {
     motor = GetComponent <VRCharacterMotor>();
 }