Ejemplo n.º 1
0
        public Thing(byte a_id, Model a_model, bool a_IsUnit, int a_hp, int a_maxHP, Vector3 a_position, float a_buildTime, int a_supplyValue, int a_price, addUnderAttackPosition a_function)
        {
            m_ownerID = a_id;

            m_isUnit = a_IsUnit;

            m_exists = true;
            m_alive  = true;
            m_model  = a_model;
            m_maxHP  = a_maxHP;
            HP       = a_hp;

            m_price = a_price;

            if (a_buildTime > 0)
            {
                m_HPhealFactor = 0.9f * (1 / a_buildTime);
            }
            else
            {
                m_hp = 1;
            }

            m_underAttackFunction = a_function;

            m_thingState = ThingState.BeingBuilt;

            m_currentposition = a_position;

            m_requiredBuildTime = a_buildTime;

            m_supplyValue = a_supplyValue;
            if (m_supplyValue < 0)
            {
                m_supplyValue = 0;
            }

            //initiate actionboxes
            for (int y = 0; y < m_actionbox.GetLength(1); y++)
            {
                for (int x = 0; x < m_actionbox.GetLength(0); x++)
                {
                    m_actionbox[x, y] = new ObjectAction();
                }
            }
        }
Ejemplo n.º 2
0
        public Cube(byte a_id, Model a_model, int a_hp, int a_maxHP, Vector3 a_position, float a_speed, addUnderAttackPosition a_function)
            : base(a_id, a_model, true, a_hp, a_maxHP, a_position, a_speed, 4.0f, 1, 0, a_function)
        {
            m_type = ThingType.C_Cube;

            m_size = new Vector3(1);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The constructor sets a unit m_model, initial m_hp, m_position, m_speed and units m_size.
        /// </summary>
        public Unit(byte a_id, Model a_model, bool a_isUnit, int a_hp, int a_maxHP, Vector3 a_position, float a_speed, float a_buildTime, int a_supplyValue, int a_price, addUnderAttackPosition a_function)
            : base(a_id, a_model, a_isUnit, a_hp, a_maxHP, a_position, a_buildTime, a_supplyValue, a_price, a_function)
        {
            m_speed = a_speed;

            //sets basic unit actions
            m_actionbox[0, 0] = new ObjectAction("Move", "Move the unit", Microsoft.Xna.Framework.Input.Keys.M, ObjectAction.Type.Target, MoveFunction);
            m_actionbox[1, 0] = new ObjectAction("Stop", "Stop the unit", Microsoft.Xna.Framework.Input.Keys.S, ObjectAction.Type.Instant, StopFunction);
            m_actionbox[2, 0] = new ObjectAction("Attack", "Attack a target", Microsoft.Xna.Framework.Input.Keys.A, ObjectAction.Type.Target, AttackFunction);

            m_actionbox[0, 1] = new ObjectAction("Hold", "Hold the position", Microsoft.Xna.Framework.Input.Keys.H, ObjectAction.Type.Instant, HoldFunction);
        }
Ejemplo n.º 4
0
        public Barrack(byte a_id, Microsoft.Xna.Framework.Graphics.Model a_model, int a_hp, int a_maxHP, Vector3 a_position, addUnderAttackPosition a_function)
            : base(a_id, a_model, false, a_hp, a_maxHP, a_position, BuildTime, SupplyValue, Price, a_function)
        {
            m_type = ThingType.C_Barrack;

            m_size = new Vector3(3, 3, 2);

            m_actionbox[0, 2] = new ObjectAction("Cancel",
                                                 "Cancels the building from being built and returns ~75% of resources",
                                                 Microsoft.Xna.Framework.Input.Keys.Escape,
                                                 ObjectAction.Type.Instant, CancelMeFunction);
        }
Ejemplo n.º 5
0
 public Barbarian(byte a_id, Microsoft.Xna.Framework.Graphics.Model a_model, int a_hp, int a_maxHP, Vector3 a_position, float a_speed, addUnderAttackPosition a_function)
     : base(a_id, a_model, true, a_hp, a_maxHP, a_position, a_speed, BuildTime, SupplyValue, Price, a_function)
 {
     m_type = ThingType.C_Barbarian;
     m_size = new Vector3(1);
 }
Ejemplo n.º 6
0
 public Extractor(byte a_id, Model a_model, int a_hp, int a_maxHP, Vector3 a_position, SoL a_SoL, addUnderAttackPosition a_Function)
     : this(a_id, a_model, a_hp, a_maxHP, a_position, a_Function)
 {
     SetSoL(a_SoL);
 }