Exemplo n.º 1
0
    public void Select()
    {
        //Modify combat control of player by replacing designated ability
        if (ability.RequiresReplacement)
        {
            CombatControl cc = Ability.Player.GetComponent <CombatControl>();

            switch (ability.AbilityClassification)
            {
            case AbilityType.COMBAT:
                break;

            case AbilityType.SPECIAL:
                break;

            case AbilityType.ENVRIONMENTAL:
                break;
            }
        }

        ability.Select();
        //Modify ultimate selection if applicable
        if (Ultimate && tree != null)
        {
            tree.PassUltimate();
        }
    }
Exemplo n.º 2
0
 void Awake()
 {
     TextUI.defualtFontSize = 8;
     TextUI.defualtPopTime  = 0.3f;
     if (self == null)
     {
         self = this;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Chases the player's current position. Updates the attack timer and
        /// attacks the player if he is close enough.
        /// </summary>
        /// <param name="a_playerPosition">Rectangle of the player position.</param>
        public void ChasePlayer(Rectangle a_playerPosition)
        {
            if (m_attackTimer > 0)
            {
                m_attackTimer--;
            }

            if (GetDistance(m_position, m_origin) > m_pursueDistance)
            {
                m_returnToOrigin = true;
                m_pursuePlayer   = false;
            }
            else if (m_position.X < a_playerPosition.X && m_position.Y < a_playerPosition.Y)
            {
                MoveRight();
                MoveDown();
            }
            else if (m_position.X > a_playerPosition.X && m_position.Y > a_playerPosition.Y)
            {
                MoveLeft();
                MoveUp();
            }
            else if (m_position.X > a_playerPosition.X && m_position.Y < a_playerPosition.Y)
            {
                MoveLeft();
                MoveDown();
            }
            else if (m_position.X < a_playerPosition.X && m_position.Y > a_playerPosition.Y)
            {
                MoveRight();
                MoveUp();
            }
            else if (m_position.X > a_playerPosition.X)
            {
                MoveLeft();
            }
            else if (m_position.X < a_playerPosition.X)
            {
                MoveRight();
            }
            else if (m_position.Y < a_playerPosition.Y)
            {
                MoveDown();
            }
            else //(m_position.Y > a_playerPosition.Y)
            {
                MoveUp();
            }

            if (GetDistance(new Vector2(a_playerPosition.X, a_playerPosition.Y),
                            m_position) <= m_meleeAttackDistance && m_attackTimer == 0)
            {
                CombatControl.IssueAttack(this, 0);
                m_attackTimer = 60;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Checks if any attacks are colliding with players or enemies.
 /// </summary>
 /// <param name="a_char">reference to the currently active player.</param>
 public void CheckAttackCollision(ref Entities.Player a_char)
 {
     if (m_currentMap == 1)
     {
         CombatControl.CheckCollision(ref m_EnemyMasterList1, ref a_char);
     }
     else
     {
         CombatControl.CheckCollision(ref m_EnemyMasterList2, ref a_char);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Calculates the magnitude of the specified position on the map relative to the centroid of the squad
 /// (being close to the other units in the squad will give the best magnitude/attraction).
 /// </summary>
 /// <param name="squad"></param>
 /// <param name="possibleNextPosition"></param>
 /// <param name="force"></param>
 /// <param name="forceStep"></param>
 /// <param name="rangePercentage">How big the Range to the centroid of all the Units positions in the Squad/Group</param>
 /// <returns>The magnitude of squad attraction. 0 if a unit is inside the specified range and gives a negative linear drop-off the further away the unit is from the group.</returns>
 public double PFSquadAttraction(List <UnitAgent> squad, Position possibleNextPosition, double force, double forceStep, int rangePercentage)
 {
     if (squad != null && squad.Count > 0)
     {
         double distance = possibleNextPosition.getDistance(CombatControl.CalculateCentroidPosition(squad.Select(ua => ua.SCUnit)));
         return(distance <= SCMath.GetPercentageOfMaxDistancePixels(rangePercentage)
                    ? force//0
                    : force - forceStep * distance);
     }
     log.Error("squad unit list is null or has zero elements in PFSquadAttraction");
     return(0);
 }
Exemplo n.º 6
0
        protected internal UnitAgent(Unit myUnit, UnitAgentOptimizedProperties opProp, CombatControl control)
        {
            SCUnit              = myUnit;
            this.log            = (control is CombatControl) ? control.log : null;
            this.control        = control;
            OptimizedProperties = opProp;
            LeadingStatus       = LeadingStatusEnum.None;
            EmotionalMode       = EmotionalModeEnum.None;

            HealthLevelOk = 60; //Health + armor

            UnitAgentTypeName = "Unit_Agent";
        }
Exemplo n.º 7
0
        /// <summary>
        /// Moves the map left.
        /// </summary>
        /// <param name="a_playerSpeed">The distance to move.</param>
        public void MoveLeft(int a_playerSpeed)
        {
            m_mapPos.X -= a_playerSpeed;
            //Move the map objects.
            if (m_currentMap == 1)
            {
                for (int i = 0; i < 25; i++)
                {
                    m_mapObjectCoords1[i].X -= a_playerSpeed;
                }

                if (m_EnemyMasterList1 != null)
                {
                    int counter = 0;
                    foreach (Entities.NPCBad enemy in m_EnemyMasterList1)
                    {
                        m_EnemyMasterList1[counter].MoveLeft(a_playerSpeed);
                        counter++;
                    }
                }
            }
            //Map #2
            else
            {
                for (int i = 0; i < 6; i++)
                {
                    m_mapObjectCoords2[i].X -= a_playerSpeed;
                }
                if (m_EnemyMasterList2 != null)
                {
                    int counter = 0;
                    foreach (Entities.NPCBad enemy in m_EnemyMasterList2)
                    {
                        m_EnemyMasterList2[counter].MoveLeft(a_playerSpeed);
                        counter++;
                    }
                }
            }

            if (m_lootCoords != null)
            {
                for (int i = 0; i < m_lootListSize; i++)
                {
                    m_lootCoords[i] = new Vector2
                                          (m_lootCoords[i].X - a_playerSpeed, m_lootCoords[i].Y);
                }
            }
            CombatControl.MoveObjectsLeft(a_playerSpeed);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Checks if the attack hit a player.
        /// </summary>
        /// <param name="a_npcs">List of all active NPCs on the map.</param>
        /// <param name="a_char">The player position, sent by reference.</param>
        public void CheckCollision(ref List <Entities.NPCBad> a_npcs, ref Entities.Player a_char)
        {
            int counter = 0;
            int damage  = 0;

            if (a_npcs != null)
            {
                foreach (Entities.NPCBad a in a_npcs)
                {
                    if (this.IsActive())
                    {
                        if (new Rectangle((int)m_position.X, (int)m_position.Y, m_anim[m_currentframe].Width, m_anim[m_currentframe].Height)
                            .Intersects(a_npcs[counter].GetRectangle()) && !this.ToPlayer())
                        {
                            bool melee = false;
                            if (a_char.GetClass() == Entities.Player.Class.Warrior)
                            {
                                melee = true;
                            }
                            if (a_npcs[counter].IsAlive())
                            {
                                damage = CombatControl.DealDamage(a_char, a_npcs[counter], melee, (int)m_modifier);
                                a_npcs[counter].ReduceCurrentHP(damage);
                                if (!a_npcs[counter].IsAlive())
                                {
                                    a_char.GainExp(a_npcs[counter].GetExpForKill());
                                }
                                this.Die();
                            }
                        }
                        if (new Rectangle((int)m_position.X, (int)m_position.Y, m_anim[m_currentframe].Width, m_anim[m_currentframe].Height)
                            .Intersects(a_char.GetRectangle()) && this.ToPlayer())
                        {
                            bool melee = true;
                            damage = CombatControl.DealDamage(a_npcs[counter], a_char, melee, 1);
                            a_char.ReduceCurrentHP(damage);
                            this.Die();
                        }
                    }
                    counter++;
                }
            }
        }
Exemplo n.º 9
0
 // Use this for initialization
 void Awake()
 {
     comCon = parent.GetComponent<CombatControl>();
 }
Exemplo n.º 10
0
    public override void OnStartClient()
    {
        // When we are spawned on the client,
        // find the parent object using its ID,
        // and set it to be our transform's parent.

        base.OnStartClient();
        Debug.Log("revolver started on client");
        // Debug.Log("For: " + gameObject + " Script: " + this);
        //Debug.Log("Trying to find: " + parentNetId);
        weaponOwner = ClientScene.FindLocalObject(weaponOwnerNetID);
        //Debug.Log("Parent object: " + parentObject);
        cmc = weaponOwner.GetComponentInChildren<CharacterModelControl>();
        transform.SetParent(cmc.weaponHand.transform, false);
        transform.localPosition = Vector3.zero;
        weaponOwner.GetComponent<CombatControl>().SetWeapon(this);
        cc = weaponOwner.GetComponent<CombatControl>();
        // Debug.Log("Parent set");
        weaponOwnerCollider = weaponOwner.GetComponentInChildren<Collider>();
    }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     _mCombatControl = GetComponent <CombatControl>();
     _mBasicControl  = GetComponent <BasicAbilityControl>();
 }
Exemplo n.º 12
0
 [Range(-180f, 180f)] public float offset; //angle offset of projectile
 void Start()
 {
     rb = GetComponent <Rigidbody2D>();
     combatController = GetComponent <CombatControl>();
     playerTransform  = GetComponent <Transform>();
 }
Exemplo n.º 13
0
 public void SetCombatControl(CombatControl CombatControl)
 {
     combatControl = CombatControl;
 }