private void SetAmmoIcon(BasePlayer.Ammo ammo) { switch (ammo) { case BasePlayer.Ammo.RedShell: bulletIcon.sprite = bulletIcons[0]; break; case BasePlayer.Ammo.GreenShell: bulletIcon.sprite = bulletIcons[1]; break; case BasePlayer.Ammo.BlueShell: bulletIcon.sprite = bulletIcons[2]; break; case BasePlayer.Ammo.GoldShell: bulletIcon.sprite = bulletIcons[3]; break; } }
void Update() { if (Debug) { DebugUpdate(); } if (!player.shotReady) { if (shootCooldownTimer < shootCooldownTime) { shootCooldownTimer += Time.deltaTime; bulletOverlay.localScale = new Vector3(1, 1 - (shootCooldownTimer / shootCooldownTime), 1); } else { shootCooldownTimer = 0; player.shotReady = true; } } if (player.skillsUpdated) { if (player.skillpoints[1] == SkillsController.LevelCutoff4) { spell1Icon.sprite = windIcons[3]; } else if (player.skillpoints[1] >= SkillsController.LevelCutoff3) { spell1Icon.sprite = windIcons[2]; } else if (player.skillpoints[1] >= SkillsController.LevelCutoff2) { spell1Icon.sprite = windIcons[1]; } else if (player.skillpoints[1] >= SkillsController.LevelCutoff1) { spell1Icon.sprite = windIcons[0]; } else { spell1Icon.sprite = disabledIcons[0]; } if (player.skillpoints[2] == SkillsController.LevelCutoff4) { spell2Icon.sprite = iceIcons[3]; } else if (player.skillpoints[2] >= SkillsController.LevelCutoff3) { spell2Icon.sprite = iceIcons[2]; } else if (player.skillpoints[2] >= SkillsController.LevelCutoff2) { spell2Icon.sprite = iceIcons[1]; } else if (player.skillpoints[2] >= SkillsController.LevelCutoff1) { spell2Icon.sprite = iceIcons[0]; } else { spell2Icon.sprite = disabledIcons[1]; } if (player.skillpoints[3] == SkillsController.LevelCutoff4) { spell3Icon.sprite = fireIcons[3]; } else if (player.skillpoints[3] >= SkillsController.LevelCutoff3) { spell3Icon.sprite = fireIcons[2]; } else if (player.skillpoints[3] >= SkillsController.LevelCutoff2) { spell3Icon.sprite = fireIcons[1]; } else if (player.skillpoints[3] >= SkillsController.LevelCutoff1) { spell3Icon.sprite = fireIcons[0]; } else { spell3Icon.sprite = disabledIcons[2]; } player.skillsUpdated = false; } if (player.health != healthAmt) { SetHealth(player.health); } if (player.mana != manaAmt) { SetMana(player.mana); } if (skillIndex != player.spellIndex) { skillIndex = player.spellIndex; SetSlot(skillIndex); } if (player.currentAmmo != currentAmmo) { currentAmmo = player.currentAmmo; SetAmmoIcon(player.currentAmmo); } SetAmmoCount(); }