private void SetupAvaiblePowerups() { for (int i = 0; i < Grid.childCount; i++) { Grid.GetChild(i).gameObject.SetActive(false); } PowerupSlot first = null; foreach (IPowerup powerup in PowerupFactory.GetAllPowerups()) { var obj = ObjectPool.Instantiate(PowerupIcon, Vector3.zero); obj.transform.localScale = new Vector3(1, 1, 1); obj.transform.SetParent(Grid); obj.GetComponent <PowerupSlot>().Setup(powerup); if (first == null || SelectedPowerup != null && powerup.GetType() == SelectedPowerup.GetType()) { first = obj.GetComponent <PowerupSlot>(); } } SelectPowerup(first); }
public void Setup(Colour pieceColour, int previous, int gained) { PowerupSlot = GetComponentInChildren <PowerupSlot>(); SetupSprite(pieceColour); SetupProgressBar(pieceColour, previous, gained); StartCoroutine(IncrementOverTime(pieceColour, previous, gained)); }
//------------------------------------- public void loadResources() { treathTrack = Resources.Load <GameObject>("Powerups/Particles/TreathTrack"); playerPos = GameObject.Find("Player").GetComponent <Transform>(); powerupSlot = playerPos.GetComponent <PowerupSlot>(); keyboard = Keyboard.current; gamepad = Gamepad.current; }
public void Setup(Colour pieceColour) { PowerupSlot = GetComponentInChildren <PowerupSlot>(); SetupSprite(pieceColour); var collected = PieceCollectionManager.Instance.PiecesCollected.Pieces.FirstOrDefault(x => x.PieceColour == pieceColour); SetupProgressBar(pieceColour, collected != null ? collected.Count : 0, 0); }
//-------------------------------------------------- private void Start() { currentWave = 0; combo = 1; comboTime = 0f; EnemyHealth.OnEnemyDeath += killed; spawnPoints = Transform.FindObjectsOfType <EnemySpawner>(); powerup = inv.GetComponentInParent <PowerupSlot>(); UpgradeManager.controls.Disable(); StartCoroutine(nextWave()); }
internal void SelectPowerup(PowerupSlot slot) { if (currentSelected != null) { currentSelected.button.interactable = true; } nameText.text = slot.powerup.Name; descriptionText.text = slot.powerup.Description; slot.button.interactable = false; currentSelected = slot; SelectedPowerup = slot.powerup; FindObjectOfType <PowerupCollectionInfo>().Setup(slot.powerup); SetEquipButtons(!UserPowerupManager.Instance.PowerupEquipped(slot.powerup)); }
public void OnPowerupSlotChanged(uint slotNumber, PowerupSlotContent slotContent, PowerupSlotChangedRequest.PowerupSlotData slotData) { PowerupSlot slot = slots[slotNumber]; switch (slotContent) { case PowerupSlotContent.Empty: slot.SetScale(0); break; case PowerupSlotContent.Laser: slot.SetSprite(SerializedFields.singleton.laserPowerupSprite); slot.SetColor(SerializedFields.singleton.laserPowerupColor); PowerupSlotChangedRequest.LaserPowerupSlotData laserPowerupSlotData = (PowerupSlotChangedRequest.LaserPowerupSlotData)slotData; slot.SetScale(laserPowerupSlotData.RemainingShots * 1.0f / SerializedFields.singleton.laserPowerupShots); break; case PowerupSlotContent.Boost: slot.SetSprite(SerializedFields.singleton.boostPowerupSprite); slot.SetColor(SerializedFields.singleton.boostPowerupColor); slot.SetScale(1); break; case PowerupSlotContent.Shield: slot.SetSprite(SerializedFields.singleton.shieldPowerupSprite); slot.SetColor(SerializedFields.singleton.shieldPowerupColor); slot.SetScale(1); break; case PowerupSlotContent.Repair: slot.SetSprite(SerializedFields.singleton.repairPowerupSprite); slot.SetColor(SerializedFields.singleton.repairPowerupColor); slot.SetScale(1); break; case PowerupSlotContent.Missile: slot.SetSprite(SerializedFields.singleton.missilePowerupSprite); slot.SetColor(missileTargetClientSystem.MissileTargetPlayerId.HasValue ? SerializedFields.singleton.missilePowerupColor : SerializedFields.singleton.inactivePowerupColor); slot.SetScale(1); break; } }
void Start() { powerup = GetComponent <PowerupSlot>(); ButtonsUI.button_E.text = " "; }
void Start() { powerupIcon = GetComponentInChildren <Image>(); powerupSlider = GetComponentInChildren <Slider>(); powerup = GameObject.FindGameObjectWithTag("Player").GetComponent <PowerupSlot>(); }