Exemplo n.º 1
0
    public List <AIRawSlimeAction> GetConquerActions(RawSlime slime)
    {
        // Devolvemos la accion de conquerir el terreno sobre el que esta esa slime
        List <AIRawSlimeAction> actions = new List <AIRawSlimeAction>();

        // Si no l'ha conquerit ja, pot conquerirla.
        if (!slime.GetPlayer().GetConqueredTiles().Contains(slime.GetActualTile()))
        {
            actions.Add(new AIRawSlimeAction(slime.GetId(), ActionType.CONQUER, slime.GetActualTile().getPosition()));
        }
        else if (slime.canGrow)
        {
            actions.Add(new AIRawSlimeAction(slime.GetId(), ActionType.EAT, slime.GetId()));
        }
        return(actions);
    }
Exemplo n.º 2
0
    public int GetDistanceToCloserEnemy(RawSlime slime)
    {
        int     distance = Int16.MaxValue;
        Vector2 myPos    = slime.GetActualTile().getPosition();

        foreach (RawPlayer p in players)
        {
            if (p != slime.GetPlayer())
            {
                foreach (RawSlime s in p.GetSlimes())
                {
                    Vector2 slPos = s.GetActualTile().getPosition();
                    distance = Mathf.Min(distance, Matrix.GetDistance(slPos, myPos));
                }
            }
        }
        return(distance);
    }
Exemplo n.º 3
0
    public List <RawSlime> GetSlimesInAttackRange(RawSlime slime)
    {
        List <RawSlime> canAttack = new List <RawSlime> ();
        Vector2         myPos     = slime.GetActualTile().getPosition();

        foreach (RawPlayer p in players)
        {
            if (p != slime.GetPlayer())
            {
                foreach (RawSlime s in p.GetSlimes())
                {
                    Vector2 slPos = s.GetActualTile().getPosition();
                    if (Matrix.GetDistance(slPos, myPos) <= slime.GetAttackRange())
                    {
                        canAttack.Add(s);
                    }
                }
            }
        }
        return(canAttack);
    }
Exemplo n.º 4
0
    public List <TileData> GetPossibleMovements(RawSlime slime)
    {
        List <TileData> moves = new List <TileData> ();

        if (matrix == null)
        {
            Debug.Log("MATRIX NULL");
        }
        if (slime == null)
        {
            Debug.Log("SLIME NULL");
        }
        if (slime.GetPlayer().statsCoreInfo == null)
        {
            Debug.Log("NULL");
        }
        Dictionary <TileData, List <TileData> > possible = matrix.possibleCoordinatesAndPath((int)slime.GetActualTile().getPosition().x, (int)slime.GetActualTile().getPosition().y, slime.GetMovementRange());

        foreach (TileData move in possible.Keys)
        {
            moves.Add(move);
        }
        return(moves);
    }