コード例 #1
0
ファイル: Pushable.cs プロジェクト: Dmcdominic/Ludum-Dare-42
    private void pushNextIfNotThis(Floor floor, MoveType moveType, Vector2Int truePos, Vector2Int displacement)
    {
        Vector2Int       targetPos     = truePos + displacement;
        ForegroundObject foregroundObj = floor.getForegroundObj(targetPos);

        if (foregroundObj != null && foregroundObj != this)
        {
            foregroundObj.OnInteraction(moveType, displacement);
        }
    }
コード例 #2
0
ファイル: Floor.cs プロジェクト: Dmcdominic/Ludum-Dare-42
    // Make private
    public void updateForegroundObj(Vector2Int truePos, ForegroundObject newObj)
    {
        Vector2Int gridVect = truePosToGridVect(truePos);

        if (gridVect.x < 0 || gridVect.x >= gridWidth ||
            gridVect.y < 0 || gridVect.y >= gridHeight)
        {
            return;
        }
        //Debug.Log("Updating position: " + truePos + " to object: " + newObj);
        foregroundGrid[gridVect.x, gridVect.y] = newObj;
    }
コード例 #3
0
        protected override void LoadComponentsInUIContext()
        {
            ForegroundObject.AssertIsForeground();

            // Ensure the nuget package services are initialized after we've loaded
            // the solution.
            _packageInstallerService = Workspace.Services.GetService <IPackageInstallerService>() as PackageInstallerService;
            _symbolSearchService     = Workspace.Services.GetService <ISymbolSearchService>() as SymbolSearchService;

            _packageInstallerService?.Connect(this.RoslynLanguageName);
            _symbolSearchService?.Connect(this.RoslynLanguageName);
        }
コード例 #4
0
ファイル: Player.cs プロジェクト: Dmcdominic/Ludum-Dare-42
    // Predicate to check if the player can move usign the normal movetype in a certain direction
    public bool canMoveNormal(Vector2Int displacement, Vector2Int targetPos)
    {
        if (Employee.willEmployeeMoveInto(targetPos) || Employee.willEmployeeSwapWith(truePos, targetPos))
        {
            return(false);
        }

        Tile             tile          = LevelManager.getTile(targetPos);
        ForegroundObject foregroundObj = LevelManager.getForegroundObject(targetPos);

        return((tile != null && tile.isSteppable()) && (foregroundObj == null || foregroundObj.IsSteppable(MoveType.normal, displacement)));
    }
コード例 #5
0
        protected override void LoadComponentsInUIContext()
        {
            ForegroundObject.AssertIsForeground();

            // Ensure the nuget package services are initialized after we've loaded
            // the solution.
            _packageInstallerService = Workspace.Services.GetService <IPackageInstallerService>() as PackageInstallerService;
            _symbolSearchService     = Workspace.Services.GetService <ISymbolSearchService>() as VisualStudioSymbolSearchService;

            _packageInstallerService?.Connect(this.RoslynLanguageName);
            _symbolSearchService?.Connect(this.RoslynLanguageName);

            HACK_AbstractCreateServicesOnUiThread.CreateServicesOnUIThread(ComponentModel, RoslynLanguageName);
        }
コード例 #6
0
    public bool canMoveNormal(Vector2Int displacement, Vector2Int targetPos)
    {
        Tile             tile          = LevelManager.getTile(targetPos);
        ForegroundObject foregroundObj = LevelManager.getForegroundObject(targetPos);

        if (foregroundObj)
        {
            return(false);
        }

        Vector2Int playerTruePos = GM.Instance.currentLevelManager.player.truePos;

        return(tile != null && (tile.isSteppableForNPC() || tile is Hole) && playerTruePos != targetPos);
    }
コード例 #7
0
ファイル: Floor.cs プロジェクト: Dmcdominic/Ludum-Dare-42
    // Update the foregroundGrid for this objects position, and all its additionalCoords
    public void updateFgGridForAllPos(ForegroundObject obj, Vector2Int truePos, List <Vector2Int> additionalCoords, bool initializing)
    {
        updateForegroundObj(truePos, obj);

        foreach (Vector2Int relativePos in additionalCoords)
        {
            Vector2Int pos = truePos + relativePos;
            if (initializing && getForegroundObj(pos) != null)
            {
                Debug.LogError("Two foregroundObject objects were found at (" + pos.x + ", " + pos.y + "). Please delete one.");
            }
            else
            {
                updateForegroundObj(pos, obj);
            }
        }
    }
コード例 #8
0
ファイル: Player.cs プロジェクト: Dmcdominic/Ludum-Dare-42
    // Moves the player using the given moveType, with the given displacement to the target position
    public void move(MoveType moveType, Vector2Int displacement, Vector2Int targetPosition)
    {
        StartSuccessfulStep.Invoke();

        Tile prevTile = LevelManager.getTile(truePos);

        prevTile.OnLeave();
        Tile nextTile = LevelManager.getTile(targetPosition);

        nextTile.OnStep();

        ForegroundObject foregroundObject = LevelManager.getForegroundObject(targetPosition);

        if (foregroundObject != null)
        {
            foregroundObject.OnInteraction(moveType, displacement);
        }

        switch (moveType)
        {
        case (MoveType.normal):
            if (foregroundObject is Pushable)
            {
                playerMoveAnim("Pushing", displacement);
            }
            else
            {
                playerMoveAnim("Walking", displacement);
            }
            placeByDisplacement(displacement);
            MusicManager.play_by_name("footstep");
            break;

        case (MoveType.jumpTwoTiles):
            playerMoveAnim("Jumping", displacement);
            MusicManager.play_by_name("coffee_jump");
            placeByDisplacement(displacement);
            break;
        }

        CompleteSuccessfulStep.Invoke();
    }
コード例 #9
0
ファイル: Player.cs プロジェクト: Dmcdominic/Ludum-Dare-42
    // Predicate to check if the player can move using the jumpTwoTiles movetype in a certain direction
    public bool canMoveJumpTwoTiles(Vector2Int displacement, Vector2Int jumpOverPos, Vector2Int targetPos)
    {
        Tile             tileToJump          = LevelManager.getTile(jumpOverPos);
        ForegroundObject foregroundObjToJump = LevelManager.getForegroundObject(jumpOverPos);

        if ((tileToJump != null && !tileToJump.CanBeJumpedOver()) || (foregroundObjToJump != null && !foregroundObjToJump.CanBeJumpedOver()))
        {
            return(false);
        }

        if (Employee.willEmployeeMoveInto(targetPos))
        {
            return(false);
        }

        Tile             tile          = LevelManager.getTile(targetPos);
        ForegroundObject foregroundObj = LevelManager.getForegroundObject(targetPos);

        return((tile != null && tile.isSteppable()) && (foregroundObj == null || foregroundObj.IsSteppable(MoveType.jumpTwoTiles, displacement)));
    }
コード例 #10
0
ファイル: Pushable.cs プロジェクト: Dmcdominic/Ludum-Dare-42
    // Private predicate to check if a particular position in this pushable can be
    // pushed to the respective position given incoming displacement
    private bool posCanBePushedInto(Vector2Int truePos, Vector2Int incomingDisplacement)
    {
        Vector2Int targetPos = truePos + incomingDisplacement;
        Floor      floor     = LevelManager.getFloor();

        Tile tile = floor.getTile(targetPos);

        if (tile == null || !tile.CanBePushedOnto())
        {
            return(false);
        }

        ForegroundObject foregroundObj = floor.getForegroundObj(targetPos);

        if (foregroundObj != null && (foregroundObj != this && !foregroundObj.CanBePushedInto(incomingDisplacement)))
        {
            return(false);
        }

        return(true);
    }
コード例 #11
0
 protected override void LoadComponentsInUIContext()
 {
     ForegroundObject.AssertIsForeground();
 }