void Awake() { anim = GetComponent <Animator> (); playerAudio = GetComponent <AudioSource> (); playerMovement = GetComponent <PlayerMovement> (); playerShooting = GetComponentInChildren <PlayerShooting> (); playerMana = GetComponent <PlayerMana> (); currentHealth = startingHealth; previousHealth = currentHealth; hitPointImg = healthSlider.fillRect.transform.GetComponent <Image>(); hitPointText = healthSlider.transform.Find("Fill Area").Find("Text").transform.GetComponent <Text>(); startingHealthColor = hitPointImg.color; this.startingR = hitPointImg.color.r; this.startingG = hitPointImg.color.g; this.startingB = hitPointImg.color.b; healthColor.r = startingR; healthColor.g = startingG; healthColor.b = startingB; this.isDead = false; SetIsDamaged(false); SetIsProtectedByDivineShield(false); AutoIncrement(); }
// Use this for initialization void Awake() { Instance = this; shootFireBall = GetComponentInChildren <ShootFireBall> (); playerHealth = GetComponent <PlayerHealth> (); playerMana = GetComponent <PlayerMana> (); playerMovement = GetComponent <PlayerMovement> (); orbControl = GetComponentInChildren <OrbControl> (); skill1Text = Skill1.GetComponentsInChildren <Text> (); skill2Text = Skill2.GetComponentsInChildren <Text> (); skill3Text = Skill3.GetComponentsInChildren <Text> (); skill1Image = Skill1.GetComponentInChildren <Image> (); skill2Image = Skill2.GetComponentInChildren <Image> (); skill3Image = Skill3.GetComponentInChildren <Image> (); skill1Button = Skill1.GetComponent <Button> (); skill2Button = Skill2.GetComponent <Button> (); skill3Button = Skill3.GetComponent <Button> (); skillValues.Add(new KeyValuePair <string, int> ("Explosion Size", 1)); skillValues.Add(new KeyValuePair <string, int> ("FireBolt Damage", 1)); skillValues.Add(new KeyValuePair <string, int> ("FireBall", 0)); skillValues.Add(new KeyValuePair <string, int> ("Health Up", 1)); skillValues.Add(new KeyValuePair <string, int> ("Mana Up", 1)); skillValues.Add(new KeyValuePair <string, int> ("Mana Recovery Rate", 1)); skillValues.Add(new KeyValuePair <string, int> ("Walking Speed", 1)); skillText = new string[] { "Radius +0.5 \r\nMana Cost +0.1", "SpellDamage +10 \r\nManaCost +0.2", "New Skill: FireBall\r\nPress 1 to use", "Max Health +20", "Max Mana +20", "Recovery Rate +0.2", "Speed +0.2" }; eventAdded = false; currentLevel = 1; }
// Start is called before the first frame update void Start() { //init du playerstats _playerStats = playerH.GetComponent <PlayerStats>(); playerH = FindObjectOfType <Player>().GetComponent <PlayerHealth>(); playerM = FindObjectOfType <Player>().GetComponent <PlayerMana>(); }
/// <summary> /// /// Constructor for copying player resource information /// /// </summary> public PlayerMana(PlayerMana playerMana) { CopyCommonResourceValues(playerMana); StartingMana = playerMana.StartingMana; PreviousOverload = playerMana.PreviousOverload; CurrentOverload = playerMana.CurrentOverload; }
// Use this for initialization protected void Start() { input = GetComponent <InputRouter>(); playerId = input.PlayerId; playerMovement = GetComponent <PlayerMovement>(); playerMana = GetComponent <PlayerMana>(); animationManager = GetComponent <SpineAnimationManager>(); }
private void Start() { playerMana = GetComponent <PlayerMana>(); playerShootName = "Fire" + playerNumber; // animation speed animator.SetFloat("shootAnimationSpeed", 1 / shootCooldown); shootTriggerTimer *= shootCooldown; }
// Use this for initialization void Start() { pHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth> (); pMana = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMana> (); pStamina = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina> (); pSpawn = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerSpawn> (); meaningless = gameObject.GetComponentInChildren <Text> (); bLib = GameObject.FindGameObjectWithTag("Player").GetComponent <BonusesLibrary>(); }
public void ModifyPlayerMana(ManaValueDictionary manaValues) { PlayerMana.Add(manaValues); SetDominantMana(); if (OnValueChange != null) { OnValueChange.Invoke(); } }
/// <summary> /// Determines the behavour of three primary attributes. /// Constitution increases max HP by 1 per point. /// Intellect increases max MP by 1 per point. /// Mind increases experience granted by 1% per point. /// </summary> public void AttributeModified(Attribute attribute) { PlayerHealth health = GetComponent <PlayerHealth>(); PlayerMana mana = GetComponent <PlayerMana>(); health.ModifyMaxHealth(attributes[GetAttributeID(Attributes.Constitution)].value.ModifiedValue); mana.ModifyMaxMana(attributes[GetAttributeID(Attributes.Intellect)].value.ModifiedValue); Experience.Instance.ChangeExperienceModifier((float)attributes[GetAttributeID(Attributes.Mind)].value.ModifiedValue / 100); Debug.Log(attribute.type + " was updated. New value is " + attribute.value.ModifiedValue); }
void Attack() { anim.SetBool("Attack", true); int magicIndex = Random.Range(0, magic.Length); Instantiate(magic[magicIndex], spawnMagic.position, Quaternion.identity); PlayerMana mana = (PlayerMana)manaBar.GetComponent("PlayerMana"); mana.AdjustMana(Random.Range(-5, -11)); }
void Start() { playerMov = GetComponent <PlayerMovement>(); playerMana = GetComponent <PlayerMana>(); menu = GameObject.FindGameObjectWithTag("IngameMenu").GetComponent <Menu>(); pause = menu.menuOpen; spellSelect = new string[2]; spellSelect[0] = "Fireball"; spellSelect[1] = "LightningBolt"; spell = spellSelect[0]; }
private void RefreshMana(PlayerMana playerMp) { manaPercentage = (float)playerMp.Mana / playerMp.MaxMana; try { this.Invoke((MethodInvoker) delegate { RefreshHUD(); }); } catch { } }
// Use this for initialization virtual protected void Start() { input = GetComponent <InputRouter>(); playerId = input.PlayerId; playerMovement = GetComponent <PlayerMovement>(); playerMana = GetComponent <PlayerMana>(); animationManager = GetComponent <AnimationManager>(); playerCondition = GetComponent <PlayerCondition>(); tintManager = GetComponent <TintManager>(); playerStatusDisplay = transform.Find("StatusCanvas")?.GetComponent <PlayerStatusDisplay>(); // Debug.Log("playerstatusdisplau" + playerStatusDisplay); }
private void Spell() { if (canCast) { PlayerMana.DecreaseMana(actionCost * 100); GameObject multishot = Resources.Load <GameObject>("Prefabs/Skills/Multishot"); GameObject instance = Instantiate(multishot, base.transform.position, base.transform.rotation, null); instance.transform.up = PlayerMovement.FacingDirection; canCast = false; } }
// Use this for initialization void Start() { blockResetTimer = 0; canBlock = true; attacking = false; playerStamina = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerStamina> (); pMana = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMana> (); pHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth> (); adl = gameObject.GetComponent <AttackDamageLibrary> (); itmBar = GameObject.FindGameObjectWithTag("ItemBarHolder").GetComponent <ItemBar>(); pressedR = 0; }
private void Awake() { mana = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMana>(); if (Instance == null) { Instance = this; //DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
// Use this for initialization void Start() { //strBtnName = transform.gameObject.name; countdownTxt = transform.Find("Countdown").GetComponent <Text> (); innerImg = GetComponent <Image> (); outerImg = transform.parent.GetComponent <Image> (); skillInfoText = new StringBuilder(); SetSkillInfoText(); playerMana = PlayerManager.playerGO.GetComponent <PlayerMana> (); }
private void Awake() { if (Instance == null) { Instance = this; //DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } manaRef = FindObjectOfType <PlayerMana>(); text = GetComponent <TextMeshProUGUI>(); }
void Start() { Instance = this; // Get and store a reference to our AudioSource component spellAudio = GetComponent <AudioSource>(); playerMovement = GetComponentInParent <PlayerMovement> (); playerMana = GetComponentInParent <PlayerMana> (); anim = GetComponentInParent <Animator> (); timer = (float)fireRate; }
void Start() { // Get and store a reference to our AudioSource component //spellAudio = GetComponent<AudioSource>(); playerMovement = GetComponentInParent <PlayerMovement> (); playerMana = GetComponentInParent <PlayerMana> (); playerTrans = GetComponentInParent <Transform> (); anim = GetComponentInParent <Animator> (); timer = (float)fireRate; }
public void Respawn() { if (!player.activeSelf) { AnnouncementManager.Instance.CreateAnnouncement("Rejoice"); PlayerHealth health = player.GetComponent <PlayerHealth>(); PlayerMana mana = player.GetComponent <PlayerMana>(); player.SetActive(true); health.Health = health.MaxHealth; mana.Mana = mana.MaxMana; health.UpdateHealthUI(); mana.UpdateManaUI(); player.transform.position = resPoint.position; } }
private static void UpdateMana() { bool attributesChanged = ReadMana(); attributesChanged |= ReadMaxMana(); if (attributesChanged && ManaChanged != null) { var playerMana = new PlayerMana { Mana = mana, MaxMana = maxMana }; ManaChanged(null, playerMana); } }
private void ConsumePowerUp(Collider2D player) { if (healthPowerUpAmount >= 0) { PlayerHealth ph = player.GetComponent <PlayerHealth>(); ph.HealPlayer(healthPowerUpAmount); } if (coinPowerUpAmount >= 0) { PlayerMoney pm = player.GetComponent <PlayerMoney>(); pm.GainCoins(coinPowerUpAmount); } if (manaPowerUpAmount >= 0) { PlayerMana playerMana = player.GetComponent <PlayerMana>(); playerMana.GainMana(manaPowerUpAmount); } Destroy(gameObject); }
// Use this for initialization void Awake() { //游戏开始时设定默认样式的鼠标指针 ResetMouseCursor(); playerGO = GameObject.FindGameObjectWithTag("Player"); HUDCanvasGO = GameObject.FindGameObjectWithTag("HUDCanvas"); skillPanelGO = GameObject.FindGameObjectWithTag("SkillPanel"); mainCameraGO = GameObject.FindGameObjectWithTag("MainCamera"); itemPanelGO = HUDCanvasGO.transform.Find("ItemPanel").gameObject; playerStatus = playerGO.GetComponent <PlayerHealth>(); playerMana = playerGO.GetComponent <PlayerMana>(); playerShooting = playerGO.transform.Find("GunEnd").GetComponent <PlayerShooting> (); //SetMouseCursor(); messagePanelGO = GameObject.FindGameObjectWithTag("MessagePanel"); messageTextGO = messagePanelGO.transform.Find("MessageText").gameObject; }
// Start is called before the first frame update void Start() { // Permet de ne pas détruire le UI quand on charge une scene -> sans duplication if (!UIexists) { UIexists = true; DontDestroyOnLoad(transform.gameObject); } else { Destroy(gameObject); } //init du playerstats _playerStats = playerH.GetComponent <PlayerStats>(); playerH = FindObjectOfType <Player>().GetComponent <PlayerHealth>(); playerM = FindObjectOfType <Player>().GetComponent <PlayerMana>(); }
private void RefreshHUD(PlayerMana playerMp) { long mana = playerMp.Mana; long maxMana = playerMp.MaxMana; if (maxMana == 0) { mana = 1; maxMana = 1; } try { this.Invoke((MethodInvoker) delegate { RefreshHUD(mana, maxMana); }); } catch { } }
public void ModifyOverloadEnchantment(PlayerMana manaResource = null) { string overloadSourceString = "Overload Reduction"; if (Owner.UsedResources.Contains(CardResources.Mana)) { if (manaResource == null) { manaResource = (PlayerMana)Owner.Resources.Single(x => x.ResourceType == CardResources.Mana); } var overloadEnchantment = Enchantments.Select(x => x.Enchantment).SingleOrDefault(x => x.Source == overloadSourceString); var isNew = false; if (overloadEnchantment == null) { overloadEnchantment = new UnitEnchantment() { Status = UnitEnchantment.EnchantmentStatus.OverloadPassive, Source = overloadSourceString }; isNew = true; } overloadEnchantment.AddStatModifier(StatTypes.Attack, StatModifierTypes.Modify, manaResource.TotalOverload); if (isNew) { AddEnchantment(overloadEnchantment); } else { UpdateEnchantments(); } } else { throw new Exception("Cannot modify overload enchantment for a non-mana class"); } }
IEnumerator Pickup() { // cool efect ?? // apply effect to player's mana regen PlayerMana mana = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMana>(); mana.manaRegen *= multiplier; // disables powerup collider and sprite GetComponent <Collider2D>().enabled = false; sprite.enabled = false; // visual coffee effect coffeeVisual.SetActive(true); // wait until effect ends and go back to normal yield return(new WaitForSeconds(time)); mana.manaRegen /= multiplier; coffeeVisual.SetActive(false); Destroy(gameObject); }
// Use this for initialization void Start() { timer = 0; if (PlayerPrefs.GetInt("points") != 0) { statPointsToSpend = PlayerPrefs.GetInt("points"); } else { statPointsToSpend = 0; } pHealth = gameObject.GetComponent <PlayerHealth> (); pStam = gameObject.GetComponent <PlayerStamina> (); pMana = gameObject.GetComponent <PlayerMana> (); bl = gameObject.GetComponent <BonusesLibrary> (); pMove = gameObject.GetComponent <PlayerMovement> (); enSpawn = GameObject.FindGameObjectWithTag("enemymanager").GetComponent <EnemySpawn> (); pHealth = gameObject.GetComponent <PlayerHealth> (); musicCont = gameObject.GetComponent <MusicController> (); inArena = true; //arenaIndex = 0; //currlevel = levelList [arenaIndex]; //musicCont.PlaySong (inArena); }
// Use this for initialization void Start() { summonEffectClone = null; player = GameObject.Find("Emmalyn"); mana = player.GetComponent<PlayerMana>(); }
// Use this for initialization void Start() { tempFire = gameObject.GetComponent<PlayerFire>(); tempMana = gameObject.GetComponent<PlayerMana>(); _inSkill01 = false; _inSkill02 = false; _inSkill03 = false; _cooldown01 = 5.0f; //coolTime01 = GameObject.FindGameObjectWithTag("CoolTime01").GetComponent<Text>(); //coolTime03 = GameObject.FindGameObjectWithTag("CoolTime03").GetComponent<Text>(); }
void Start() { playerMana = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMana>(); }