void Start() { controller = GetComponent <CharacterController>(); setBounds(); init(); weaponsSystem = gameObject.AddComponent <WeaponsSystem>(); }
private void OnEnable() { if (weaponsSystem == null) { weaponsSystem = gameObject.GetComponent <WeaponsSystem>(); } weaponsSystem.ShipShooting = false; }
// Unity Methods and Events #region Unity Events and Methods /// <summary> /// Initialize and Get dependencies /// </summary> /// private void Start() { if (shieldProjector == null) { shieldProjector = GetComponentInChildren <ShieldProjector>(); } if (weaponsSystem == null) { weaponsSystem = gameObject.GetComponent <WeaponsSystem>(); } if (shieldProjector == null) { shieldProjector = GetComponentInChildren <ShieldProjector>(); } if (playerHUD == null) { playerHUD = gameObject.GetComponent <PlayerHUDHandler>(); } if (rigidbody == null) { rigidbody = gameObject.GetComponent <Rigidbody>(); } foreach (Player player in GameObject.FindObjectsOfType <Player>()) { player.FindShip(); } // Set the cameras size and positions gunnerCamera.rect = new Rect(0, 0.0f, 1.0f, 0.5f); pilotCamera.rect = new Rect(0, 0.5f, 1.0f, 0.5f); gunnerCenter = gunnerslockUI.transform.position; boostGauge = myProperties.maxBoostGauge; if (!shipHP) { TryGetComponent(out shipHP); } if (!audioSource) { TryGetComponent(out audioSource); } boostDepleteDelay = myProperties.boostDepleteDelay; }
private void OnTriggerEnter(Collider other) { GameObject player = GameObject.FindGameObjectWithTag("Player"); if (player && other.gameObject.Equals(player)) //If player is found to exist and player is the one colliding { WeaponsSystem weaponsSystem = player.GetComponent <WeaponsSystem>(); weaponsSystem.GunController.ammoCount.SetAmmo(weapon, ammoCount); if (hitVFX) { GameObject go = Instantiate(hitVFX, transform.position, Quaternion.identity); go.transform.localScale = new Vector3(vfxScale, vfxScale, vfxScale); } Destroy(gameObject); } }
void Start() { controller = GetComponent<CharacterController>(); setBounds(); init (); weaponsSystem = gameObject.AddComponent<WeaponsSystem>(); }
private void OnEnable() { _weaponsSystem = (WeaponsSystem)target; iconStyle.normal.background = _weaponsSystem.defaultTexture; showWeapons = new bool[] { false, false, false, false, false }; }