public override string ToString() { var hearts = Hearts == 0.0 ? "none" : Hearts.ToString(); return($"Recipe {{ Type = '{Type}', Name = '{Name}', Hearts = {hearts}, " + $"Effects = {Helpers.ArrayToString(Effects)}, Ingredients = {Helpers.ArrayToString(Ingredients)} }}"); }
public void DoDamage(Hearts amount, Vector3 pos, Vector3 dir) { if (IsInvulnerable || !enabled || IsKilled) { return; } if (mainHealth) { mainHealth.DoDamage(amount, pos, dir); return; } ActualHp -= amount; if (ActualHp.TotalPoints <= 0) { Destruct(); return; } if (damagedEffect && createDamageEffect) { Quaternion effectRotation = Quaternion.LookRotation(dir); Destroy(Instantiate(damagedEffect, pos, effectRotation), damageEffectLifetime); } if (ActualInvulnerableTime > 0) { _invulnerableTimer = ActualInvulnerableTime; } onDamaged?.Invoke(ActualHp.TotalPoints); onDamagedEvent.Invoke(); }
// Use this for initialization void Start() { hp = maxHp; lifes = 3; lifeCanvas = GameObject.FindObjectOfType <Hearts>(); lifeCanvas.ChangeLife(lifes); }
public void DoDamage(int amount) { Hearts newDamage = new Hearts(); newDamage.hearts = amount; DoDamage(newDamage, transform.position + Vector3.back * .25f, Vector3.forward); }
public static Hearts operator+(Hearts left, int right) { Hearts newHP = new Hearts(); newHP.Recalculate(left.TotalPoints + right); return(newHP); }
public void SetHp(Hearts newHp) { if (!enabled) { return; } currentHp.Value = newHp; }
public void willGetACardWithJacks() { var validString = "J-H"; var ExpectedCard = new Hearts(Card.JACK); var ActualCard = CardBuilder.fromString(validString); Assert.AreEqual(ExpectedCard, ActualCard); }
// Use this for initialization void Start() { player = GameObject.Find("Player"); nextFire = fireDist; lastPos = player.transform.position; hearts = (Hearts)GameObject.Find("Hearts").GetComponent(typeof(Hearts)); player = GameObject.Find("Player"); }
public static Hearts Clamp(Hearts input, Hearts min, Hearts max) { int total = input.TotalPoints; int clamped = Mathf.Clamp(total, min.TotalPoints, max.TotalPoints); input.SetTotalPoints(clamped); return(input); }
// Use this for initialization void Start() { highest_pos = extent - starting_pos; lowest_pos = highest_pos - extent; nextFire = fireDist; hearts = (Hearts)GameObject.Find("Hearts").GetComponent(typeof(Hearts)); player = GameObject.Find("Player"); }
// Use this for initialization void Start() { hp = maxHp; lifes = 3; lifeCanvas = GameObject.FindObjectOfType <Hearts>(); lifeCanvas.ChangeLife(lifes); //anim = GetComponent<Animator>(); soundSource = GetComponent <AudioSource>(); }
// Use this for initialization void Start() { Debug.Log("bullet start"); // must do this otherwise new bullets don't cause damage hearts = (Hearts)GameObject.Find("Hearts").GetComponent(typeof(Hearts)); rb = GetComponent <Rigidbody2D>(); target = GameObject.FindGameObjectWithTag("Player").transform; moveDir = (target.transform.position - transform.position).normalized * maxSpeed; }
public GuiManager(ContentManager content, Texture2D defaultTex) { _playerHearts = new Hearts(content.Load <Texture2D>("gui/hearts")); _playerDamageIndicator = new DamageIndicator(defaultTex) { Color = new Color(100, 0, 0, 100), Position = Vector2.Zero, Rectangle = new Rectangle(0, 0, Game1.ScreenWidth, Game1.ScreenHeight) }; }
public void FetchNewValue() { if (currentHearts == currentHp.Value) { return; } prevHearts = currentHearts; currentHearts = currentHp.Value; // Debug.Log("Fetched new value. Prev hearts and current hearts: " + prevHearts + " " + currentHearts); }
// Start is called before the first frame update void Start() { // Assigns rigidbody of gameobject to rb rb = GetComponent <Rigidbody2D>(); m_Collider = GetComponent <PolygonCollider2D>(); //l_Text = GameObject.Find("LivesText").GetComponent<Text>(); //DisplayLives(); hearts = GameObject.FindObjectOfType <Hearts>(); }
public static Hearts operator-(Hearts left, int right) { Hearts newHP = new Hearts(); int newPoints = left.TotalPoints - right; if (newPoints < 0) { newPoints = 0; } newHP.Recalculate(newPoints); return(newHP); }
public void Heal(Hearts amount) { if (!enabled) { return; } ActualHp += amount; ActualHp = Hearts.Clamp(ActualHp, 0, maxHearts.Value); if (onHealed != null) { onHealed.Invoke(amount.TotalPoints); } }
// Use this for initialization void Start() { instance = this; dissolved = new bool[hearts.Length]; need_dissolved = new bool[hearts.Length]; need_grow = new bool[hearts.Length]; for (int i = 0; i < hearts.Length; i++) { dissolved[i] = true; need_dissolved[i] = false; need_grow[i] = true; } }
void Start() { animator = transform.GetComponent <Animator> (); lastFireTime = Time.time; iceCream = ((GameObject)Resources.Load("GameObjects/IceCream/IceCream", typeof(GameObject))).transform; iceCreamPuddle = ((GameObject)Resources.Load("GameObjects/IceCreamPuddle/IceCreamPuddle", typeof(GameObject))).transform; mainCamera = GameObject.FindGameObjectWithTag("MainCamera").transform; energyBar = transform.Find("Bar").GetComponent <Bar>(); hearts = transform.Find("Hearts").GetComponent <Hearts>(); ui = GameObject.FindGameObjectWithTag("UI").GetComponent <UI> (); ApplyHat(); ApplyHair(); ApplySkin(); }
public override bool Equals(object other) { if (other == null || other.GetType() != GetType()) { return(false); } var otherRecipe = (Recipe)other; return(Type.Equals(otherRecipe.Type) && Name.Equals(otherRecipe.Name) && Hearts.Equals(otherRecipe.Hearts) && Effects.OrderBy(e => e).SequenceEqual(otherRecipe.Effects.OrderBy(e => e)) && Ingredients.OrderBy(i => i).SequenceEqual(otherRecipe.Ingredients.OrderBy(i => i))); }
public void Dispose() { Heart?.Dispose(); Hearts?.Dispose(); Stage?.Dispose(); PenguinSliding?.Dispose(); PenguinWalking?.Dispose(); PenguinWithBoard?.Dispose(); UIBackground?.Dispose(); Grzesiek?.Dispose(); DOG?.Dispose(); Alex?.Dispose(); Kamil?.Dispose(); Marcin?.Dispose(); Marek?.Dispose(); Tymon?.Dispose(); PenguinIcons?.Dispose(); }
public void HandleShowResult(ShowResult result) { switch (result) { case ShowResult.Finished: heart = GameObject.FindGameObjectWithTag("Hearts").GetComponent <Hearts>() as Hearts; heart.AddHeart(); Debug.Log("<color=green>The ad was skipped before reaching the end.</color>"); break; case ShowResult.Skipped: Debug.Log("<color=yellow>The ad was skipped before reaching the end.</color>"); break; case ShowResult.Failed: Debug.LogError("<color=red>The ad failed to be shown.</color>"); break; } }
public static void SaveStore() { WebGLJump.SaveData(SaveKeys.Money, Money.ToString()); WebGLJump.SaveData(SaveKeys.Hearts, Hearts.ToString()); WebGLJump.SaveData(SaveKeys.Armor, Armor.ToString()); WebGLJump.SaveData(SaveKeys.Healing, Healing.ToString()); for (int i = 0; i < GunOwned.Length; ++i) { WebGLJump.SaveData(SaveKeys.GunOwned + i.ToString(), GunOwned[i].ToString()); } for (int i = 0; i < GunPower.Length; ++i) { WebGLJump.SaveData(SaveKeys.GunPower + i.ToString(), GunPower[i].ToString()); } for (int i = 0; i < GunEquipped.Length; ++i) { WebGLJump.SaveData(SaveKeys.GunEquipped + i.ToString(), GunEquipped[i].ToString()); } }
void FindGameObjects() { GameObject go = GameObject.Find("Score"); if (go != null) { scoreDisplay = go.GetComponent <Text>(); } go = GameObject.Find("HiScore"); if (go != null) { hiScoreDisplay = go.GetComponent <Text>(); } go = GameObject.Find("Hearts"); if (go != null) { hearts = go.GetComponent <Hearts>(); } }
public void spawnPlayer() { var evnt = PlayerVisibilityChanged.Create(Bolt.GlobalTargets.Others); evnt.Player = player.GetComponent <FirstPersonController>().GetEntity(); evnt.Visible = true; evnt.Send(); player.SetActive(true); player.GetComponent <FirstPersonController>().bindMouse(); activate_ALIVE_UI(); ArmorAndWeapons armor = ArmorUI.GetComponent <ArmorAndWeapons>(); Stamina stamina = StaminaUI.GetComponent <Stamina>(); Hearts health = HealthUI.GetComponent <Hearts>(); WeaponControl weapons = EquipmentUI.GetComponent <WeaponControl>(); armor.resetArmor(); stamina.resetStamina(); health.resetHealth(); weapons.onSpawn(); player.transform.position = randomSpawnpoint(); }
public void Refresh(Hearts displayedValue) { for (int i = 0; i < hearts.Count; i++) { var heart = hearts[i]; heart.gameObject.SetActive(i < maxHp.Value.hearts); if (!heart.isActiveAndEnabled) { continue; } // if this is the last heart, show fractions if (i == displayedValue.hearts && displayedValue.fractions > 0) { heart.fraction = displayedValue.fractions; } // otherwise, show full / empty hearts else { heart.filled = i < displayedValue.hearts; } } }
void Awake(){ Instance = this; }
void Start() { player = playerComp.GetComponent<PlayerController>(); hearts = heartsComp.GetComponent<Hearts>(); }
void Subtract() { value -= 1; }
void AddInput() { value += input; }
void SubtractInput() { value -= input; }
void SetValue(int qty) { value = qty; }
// Use this for initialization void Start () { m_Health = m_MaxHealth; m_Heart = GameObject.Find("Hearts").GetComponent<Hearts>(); }
public void DoDamage(Hearts amount) { DoDamage(amount, transform.position + Vector3.back * .25f, Vector3.forward); }