コード例 #1
0
        int maxHealth; // THe maximum health the entity has

        #endregion Fields

        #region Constructors

        // Constructor; Derived classes create an entity object
        public Hostile(int ID, GameObject gameObject)
            : base(ID, gameObject)
        {
            // Get the GameObject's ally script
            allyScript = GameObj.GetComponent<AllyList>();

            #region IEquipment Variable Initialisation

            // The entity isn't wearing any armour, wielding any weapon, or has any bonuses
            equippedArmor = null;
            equippedWeapon = null;
            bonuses = new List<Bonus>();
            attackPower = 0;
            defencePower = 0;

            #endregion

            #region IDamageable Variable Initialisation

            // The default hard coded values for now.
            health = 50;
            maxHealth = 50;
            isDead = false;

            #endregion
        }
コード例 #2
0
        MercenaryMB script; // THe script reference for the Mimic enemy.

        #endregion Fields

        #region Constructors

        // Constructor used to create a Mercenary entity
        public Mercenary(int ID, GameObject gameObject)
            : base(ID, gameObject)
        {
            // Set the entity's type to Mercenary
            Type = EntityType.Mercenary;

            // Also set the entity's friendly type
            FriendlyType = Entities.FriendlyType.Mercenary;

            // Set the entity's script reference
            script = GameObj.GetComponent<MercenaryMB>();

            #region IEquipment Variable Initialisation

            // The entity isn't wearing any armour, wielding any weapon, or has any bonuses
            equippedArmor = null;
            equippedWeapon = null;
            bonuses = new List<Bonus>();
            attackPower = 0;
            defencePower = 0;

            #endregion
        }
コード例 #3
0
 // Unequips a weapon for the entity
 public void UnequipWeapon(Weapon weapon)
 {
     // Only unequip the weapon if the merchant is wielding any
     if (equippedWeapon != null)
     {
         // Unequip the given weapon
         attackPower -= weapon.AttackValue;
         equippedWeapon = null;
     } // end if
 }
コード例 #4
0
        // Equips a weapon for an entity
        public void EquipWeapon(Weapon weapon)
        {
            // Check if the merchant is wielding a weapon
            if (equippedArmor == null)
            {
                // The merchant isn't wielding a weapon so just equip the given weapon
                attackPower += weapon.AttackValue;
                equippedWeapon = weapon;
            } // end if
            else
            {
                // The merchant is already wielding a weapon so unequip it first
                UnequipWeapon(equippedWeapon);

                // Now wield the given weapon
                attackPower += weapon.AttackValue;
                equippedWeapon = weapon;
            } // end else
        }