void Start() { _ih = GetComponent <InputHandler>(); _pr = GetComponentInChildren <PlayerRotation>(); _cc = GetComponent <CharacterController>(); _anim = GameObject.Find("Arms").GetComponent <Animator>(); _inventory = Inventory.Instance; _gun = GetComponentInChildren <GunManager>(); _camAnim = Camera.main.gameObject.GetComponent <Animator>(); _rb = GetComponent <Rigidbody>(); _col = GetComponent <CapsuleCollider>(); _inventory.Initialize(); if (debugMode) { _inventory.MaxAll(); } Cursor.lockState = CursorLockMode.Locked; if (SceneManager.GetActiveScene().name.Contains("Level")) { if (SceneManager.GetActiveScene().name.Contains("1")) { Saver.Instance.DeleteProgress(); var stats = Saver.Instance.GetStats(); Inventory.Instance._health = 100; Inventory.Instance._pistolAmmo = 15; Inventory.Instance._shotgunAmmo = 5; Inventory.Instance._rocketLauncherAmmo = 1; Inventory.Instance.RemoveItem(EItemType.SHOTGUN); Inventory.Instance.RemoveItem(EItemType.ROCKET_LAUNCHER); Inventory.Instance.RequestUpdateHUD(); } else { var stats = Saver.Instance.GetStats(); if (stats.hasShotgun) { Inventory.Instance.AddItem(EItemType.SHOTGUN); } if (stats.hasRocketLauncher) { Inventory.Instance.AddItem(EItemType.ROCKET_LAUNCHER); } Inventory.Instance._health = stats.health; Inventory.Instance._pistolAmmo = stats.pistolAmmo; Inventory.Instance._shotgunAmmo = stats.shotgunAmmo; Inventory.Instance._rocketLauncherAmmo = stats.rocketLauncherAmmo; Inventory.Instance.RequestUpdateHUD(); } } _playerPainKey = Pool.Instance.GetSharedPoolKey("PlayerPain"); _playerJumpKey = Pool.Instance.GetSharedPoolKey("PlayerJump"); _playerDeathKey = Pool.Instance.GetSharedPoolKey("PlayerDeath"); }
public void Initialize() { _gun = GameObject.Find("Gun").GetComponent <GunManager>(); _gui = GameObject.Find("Canvas").GetComponent <GUIManager>(); _cards = new List <ECards>(); _pistolAmmo = pistolInitalAmmo; _health = 100; _takePistolAmmoKey = Pool.Instance.GetSharedPoolKey("TakePistolAmmo"); _takeShotgunAmmoKey = Pool.Instance.GetSharedPoolKey("TakeShotgunAmmo"); _takeRocketLauncherAmmoKey = Pool.Instance.GetSharedPoolKey("TakeRocketLauncherAmmo"); _takeAmmoKitKey = Pool.Instance.GetSharedPoolKey("TakeAmmoKit"); _takeMedkitKey = Pool.Instance.GetSharedPoolKey("TakeMedkit"); _takeCardKey = Pool.Instance.GetSharedPoolKey("TakeCard"); UpdateHUD(); }
private void Awake() { _gun = GetComponentInChildren <GunManager>(); }
private void Start() { _gun = GameObject.Find("Player").GetComponentInChildren <GunManager>(); }