Example #1
0
    public override bool ValidateSelection(Entity entity)
    {
        if (entity.GetEntityType() != "Tile")
            return false;

        Tile tile = entity as Tile;

        if (tile.Occupied)
            return false;

        if (!tile.Walkable)
            return false;

        Tile playerTile = character.currentTile;

        int xDif = Mathf.Abs(playerTile.X - tile.X);
        if (xDif > moveRange)
            return false;

        int yDif = Mathf.Abs(playerTile.Y - tile.Y);
        if (yDif > moveRange)
            return false;

        if ((xDif + yDif) > moveRange)
            return false;

        return character.GetActionPoints() > 0;
    }
Example #2
0
    public override void OnSelctionAction(Entity entity)
    {
        if (entity.GetEntityType() != "SlideCharacter") return;
        var slide = entity as SlideCharacter;
        if (slide.Team != team) return;

        if (selectedCharacter)
        {
            ConflictController.Instance.RemovePulseMaterial(selectedCharacter.GetComponent<Renderer>());
        }
        selectedCharacter = entity as SlideCharacter;

        AbilityButtonControl.Instance.ChangeSelectedCharacter(slide);
        GridController.DisplayMoveRange(selectedCharacter);

        ConflictController.Instance.AddPulseMaterial(selectedCharacter.Avatar.GetComponent<Renderer>());
    }
Example #3
0
    public override bool ValidateSelection(Entity entity)
    {
        if (character.GetActionPoints() <= 0) return false;
        switch (targetType)
        {
            case TargetType.Character:
                if (entity.GetEntityType() != "SlideCharacter")
                {
                    return false;
                }

                SlideCharacter ch = entity as SlideCharacter;

                switch (targetFilter)
                {
                    case TargetFilter.Enemy:
                        if (ch.Team == character.Team) return false;
                        break;
                    case TargetFilter.Freindly:
                        if (ch.Team != character.Team) return false;
                        break;
                    default:

                        break;
                }

                break;
            case TargetType.Tile:
                if (entity.GetEntityType() != "Tile") return false;
                break;
            case TargetType.Either:
                if (entity.GetEntityType() != "Tile" && entity.GetEntityType() != "SlideCharacter") return false;
                break;
            case TargetType.Self:
                if (entity != character) return false;
                break;
            default:
                return false;
        }

        var tile = entity.getCurrentTile();
        int xDif = Mathf.Abs(tile.X - character.currentTile.X);
        if (xDif > range)
        {
            return false;
        }
        int yDif = Mathf.Abs(tile.Y - character.currentTile.Y);
        if (yDif > range)
        {
            return false;
        }
        int total = xDif + yDif;
        if (targetRange == TargetRange.Melee)
        {
            if (total > 2)
            {
                return false;
            }
        }
        else
        {
            if (total > (range * 2))
            {
                return false;
            }
        }
        return true;
    }
Example #4
0
    public bool OnEntitySelection(Entity entity)
    {
        if (entity.GetEntityType() == "Tile")
            currentAction = allowedActions["Move"];

        if (currentAction.ValidateSelection(entity) == false)
        {
            return false;
        }
        currentAction.PreformAction(entity);

        currentAction = fallbackAction;
        return true;
    }