Esempio n. 1
0
 public override bool canAttack(GameObject attackee)
 {
     if (DistUtility.distCategorizer(this.pos, attackee.GetComponent <characters>().pos, this.range) != 0)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
 public override bool canAttack(GameObject attackee)
 {
     if (DistUtility.isImmediateDiagonal(this.pos, attackee.GetComponent <characters>().pos))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
    public override bool canAttack(GameObject attackee)
    {
        characters a = attackee.GetComponent <characters> ();

        if (DistUtility.isInRange(this.pos, a.pos, this.range))
        {
            return(true);
        }
        return(false);
    }
Esempio n. 4
0
    public bool collisionCheck(GameObject obj)
    {
        position pos = DistUtility.getPos(obj);

        foreach (characters c in this.gameObject.GetComponentsInChildren <characters>())
        {
            if (c.pos.Equals(pos))
            {
                return(true);
            }
        }
        return(false);
    }
Esempio n. 5
0
    /*
     * Returns the number of entities that are
     * next to (only vertically and horizontally)
     * this character.
     */
    public int numHelpers(List <GameObject> attackingTeam)
    {
        int numHelper = 0;

        foreach (GameObject helper in attackingTeam)
        {
            if (DistUtility.isNextTo(this.pos, helper.GetComponent <characters>().pos))
            {
                ++numHelper;
            }
        }
        return(numHelper);
    }
Esempio n. 6
0
    private List <GameObject> checkForHelpers(List <GameObject> helpingEntities, GameObject defendingPlayer)
    {
        characters        helperAtr;
        List <GameObject> helpers     = new List <GameObject>();
        position          defenderPos = defendingPlayer.GetComponent <characters> ().pos;

        foreach (GameObject helpingEntity in helpingEntities)
        {
            helperAtr = helpingEntity.GetComponent <characters>();
            if (helpingEntity != this.gameObject && helperAtr.entityType == "attacker")
            {
                if (DistUtility.isInbetween(this.pos, defenderPos, helperAtr.pos))
                {
                    if (helperAtr.canAttack(defendingPlayer))
                    {
                        helpers.Add(helpingEntity);
                    }
                }
            }
        }
        return(helpers);
    }