Пример #1
0
 public void onHit()
 {
     if (isEnabled)
     {
         if (_health.isAlive)
         {
             _playerHealth.Add(onHitAmount);
         }
         else
         {
             _playerHealth.Add(onKillAmount);
         }
     }
 }
Пример #2
0
        public void Load(string value)
        {
            var lines = File.ReadAllLines(value);

            foreach (var line in lines)
            {
                if (line.ToLower().Contains("example") || line.ToLower().Contains("[spells]"))
                {
                    //Ignore
                }
                else
                {
                    var temp = line.Split('_');
                    SpellNames.Add(temp[0]);
                    Health.Add(Convert.ToInt32(temp[1]));
                    SpellKeys.Add(temp[2]);
                    CastTime.Add(Convert.ToInt32(temp[3]));
                    Mana.Add(Convert.ToInt32(temp[4]));
                    Range.Add(Convert.ToInt32(temp[5]));
                    Type.Add(temp[6]);
                    Combo.Add(Convert.ToInt32(temp[7]));
                    MinDistance.Add(Convert.ToInt32(temp[8]));
                    EnemyHealth.Add(Convert.ToInt32(temp[9]));
                }
            }
        }
Пример #3
0
    private void PullHeat(GameObject a_target)
    {
        if (m_health.Count == m_health.Maximum &&
            m_ammoCounter.Count == m_ammoCounter.Maximum)
        {
            StopCharge();
            return;
        }

        var lava = a_target.GetComponent <Lava>();

        if (lava == null)
        {
            StopCharge();
            return;
        }

        var heat = lava.PullHeat();

        if (heat == 0)
        {
            StopCharge();
            return;
        }
        if (m_health.Count < m_health.Maximum)
        {
            m_health.Add(heat * 3);
        }
        else
        {
            m_ammoCounter.Add(heat);
        }
    }
Пример #4
0
        /// <summary> Spawns a random entity in the world </summary>
        public void SpawnEntity()
        {
            NPC entity = null;

            switch (random.Next(0, 3)) // Number is >= 0 and < 3
            {
            // Monster
            case 0:
                entity = RandomMonster();
                Monsters.Add((Monster)entity);
                this.Controls.Add(entity);
                break;

            // Money
            case 1:
                entity = RandomMoney();
                Money.Add((Money)entity);
                this.Controls.Add(entity);
                break;

            // Health
            case 2:
                entity = RandomHealth();
                Health.Add((Health)entity);
                this.Controls.Add(entity);
                break;

            default:
                break;
            }
        }
Пример #5
0
    public void OnGetShot(GameObject from, float damage)
    {
        health.Add(-damage);
        MainCanvas.Instance.UpdateHealth();
        if (health.IsDead())
        {
            StopAllCoroutines();
            gameObject.SetActive(false);
            //GameOver
            if (OnPlayerDeath != null)
            {
                OnPlayerDeath();
            }

            MainCanvas.Instance.EnableGameOver(true);
        }
    }
Пример #6
0
 public void UpdateLogs(Fighter fighter)
 {
     Hits.Add(fighter.Hits);
     Health.Add(fighter.HealthPoints);
     DealtDamage.Add(fighter.DealtDamage);
     Rounds.Add(fighter.Rounds);
     if (!fighter.IsAlive())
     {
         Deaths++;
     }
 }
Пример #7
0
    /*
     * Purpose:                Add object to caravan.
     * Effects:                Part's parent is now 1 of 12 transforms children of the caravan (caravan is now grandparent!)
     * Input/Output:           N/A.
     * Global Variables Used:  caravan_tf, part_slot_tf, caravan, char_control (Class InteractWithCaravan), transform, parts_tf (Class Caravan),
     *                      transform (Class Part), has_object (Class CharacterControl), Player_Inventory.CaravanPart,
     */
    public void AddToCaravan()
    {
        Part part = transform.GetChild(0).GetChild(0).GetComponent <Part>();

        part_slot_tf = caravan.FindPartSlot(part.transform);
        part.AttachTo(part_slot_tf);

        caravan.parts_tf.Add(part.transform);
        p_inv.CaravanPart -= 1;

        health.Add(part.healthValue);
    }
Пример #8
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.CompareTag("Food"))
     {
         col.gameObject.SetActive(false);
         audioSource.PlayOneShot(eatingSound);
         health.Add();
         if (!handicap.teeth)
         {
             timeOut = 3.0f;
         }
     }
 }
Пример #9
0
    public void OnGetBombed(float damage)
    {
        if (health != null)
        {
            health.Add(-damage);
            if (health.IsDead())
            {
                gameObject.SetActive(false);
                personality = null;
                if (Diagnostic.Instance.enemyReference == gameObject)
                {
                    Diagnostic.Instance.enemyReference = null;
                }
            }
        }

        Diagnostic.Instance.UpdateHealth(this.gameObject, health.GetHealth());
        if (personality != null)
        {
            personality.OnGetBombed();
        }
    }
Пример #10
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        string tag = collider.gameObject.tag;

        if (tag == "Checkpoint")
        {
            lastCheckpoint = collider.gameObject.transform.position;
        }
        else if (tag == "Kill")
        {
            transform.position = lastCheckpoint;
        }

        if (tag == "health")
        {
            if (health.currentHealth < 10)
            {
                health.Add(1);
            }
            Destroy(collider.gameObject);

            lastCheckpoint = gameObject.transform.position;
        }
    }
Пример #11
0
    private void Heal(int value)
    {
        Health health = _player.GetComponent <Health>();

        health.Add(value);
    }
Пример #12
0
 public void CanAddHealth()
 {
     health.Add(100);
     Assert.AreEqual(200, health.health);
 }