Exemplo n.º 1
0
    void DrawPath_Between(EntityData entity, Vector2Int positionLastState, Vector2Int positionThisState, Vector2Int positionNextState)
    {
        PathType  pathType            = GetPathType(positionLastState, positionThisState, positionNextState);
        Sprite    pathSprite          = ScenarioImageManager.GetPathSprite(pathType);
        Direction directionOfEntrance = BoardHelperFunctions.GetDirectionFromPosition(positionThisState, positionLastState);

        GenerateAndPositionCellImage(positionThisState, GetImageRotation(directionOfEntrance), pathSprite, entity.IdentifyingColor);
    }
Exemplo n.º 2
0
    void DrawPath_Ending(EntityData entity, Vector2Int positionLastState, Vector2Int positionThisState)
    {
        if (positionThisState == positionLastState)
        {
            return;
        }

        Sprite    pathSprite          = ScenarioImageManager.GetPathSprite(PathType.Terminating);
        Direction directionOfEntrance = BoardHelperFunctions.GetDirectionFromPosition(positionThisState, positionLastState);

        GenerateAndPositionCellImage(positionThisState, GetImageRotation(directionOfEntrance), pathSprite, entity.IdentifyingColor);
    }
Exemplo n.º 3
0
    void DrawBump(EntityData bumpingEntity, ProjectedGameState projectedState, ProjectedGameState nextState, Bump bump)
    {
        Vector2Int positionTwoStatesAgo = projectedState
                                          .scenarioState
                                          .lastGameState
                                          .lastGameState
                                          .GetEntityWhere(e => e.ID == bumpingEntity.ID)
                                          .Position;
        Vector2Int positionThisState = bumpingEntity.Position;
        Vector2Int positionLastState = projectedState
                                       .scenarioState
                                       .lastGameState
                                       .GetEntityWhere(e => e.ID == bumpingEntity.ID)
                                       .Position;
        bool isEntitysFirstMove = positionLastState == positionTwoStatesAgo;

        bool bumpSucceeds = bumpingEntity.Position != positionLastState;

        if (bumpSucceeds)
        {
            DrawPath_Ending(bumpingEntity, positionLastState, positionThisState);
            DrawSuccessfulBumpEffect(positionThisState, BoardHelperFunctions.GetDirectionFromPosition(positionThisState, positionLastState));

            DrawPath_Beginning(bump.bumpedEntity, positionThisState, bump.bumpedEntity.Position);
        }
        else if (isEntitysFirstMove)
        {
            Vector2Int bumpedEntityPosition = bump.bumpedEntity.Position;
            Sprite     pathSprite           = ScenarioImageManager.GetPathSprite(PathType.Beginning);
            Direction  directionOfEntrance  = BoardHelperFunctions.GetDirectionFromPosition(bumpedEntityPosition, positionThisState);
            GenerateAndPositionCellImage(positionThisState, GetImageRotation(directionOfEntrance), pathSprite, bumpingEntity.IdentifyingColor);

            DrawFailedBumpEffect(positionThisState,
                                 BoardHelperFunctions.GetDirectionFromPosition(positionThisState, bumpedEntityPosition));
        }
        else
        {
            PathType   pathType             = GetFailedBumpPathType(positionTwoStatesAgo, positionThisState, bump.bumpedEntity.Position);
            Sprite     pathSprite           = ScenarioImageManager.GetPathSprite(pathType);
            Vector2Int bumpedEntityPosition = bump.bumpedEntity.Position;
            Direction  directionOfEntrance  = BoardHelperFunctions.GetDirectionFromPosition(positionThisState, positionTwoStatesAgo);

            GenerateAndPositionCellImage(positionThisState, GetImageRotation(directionOfEntrance), pathSprite, bumpingEntity.IdentifyingColor);
            DrawFailedBumpEffect(positionThisState,
                                 BoardHelperFunctions.GetDirectionFromPosition(positionThisState, bumpedEntityPosition));
        }
    }
Exemplo n.º 4
0
    void DrawFailedBumpEffect(Vector2Int position, Direction entranceDirectionOfBumper)
    {
        Sprite bumpEffectSprite = ScenarioImageManager.GetPathSprite(PathType.Bumped);

        GenerateAndPositionCellEdgeImage(position, entranceDirectionOfBumper, bumpEffectSprite, Color.white);
    }
Exemplo n.º 5
0
    void DrawSuccessfulBumpEffect(Vector2Int position, Direction entranceDirectionOfBumper)
    {
        Sprite bumpEffectSprite = ScenarioImageManager.GetPathSprite(PathType.Bumped);

        GenerateAndPositionCellImage(position, GetImageRotation(entranceDirectionOfBumper), bumpEffectSprite, Color.white);
    }