コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     transform.position = HexMapHelper.GetWorldPointFromTile(
         tilePositionObject.GetPivotTilePosition(), tilePositionObject.GetPivotTileLevel())
                          + (HexMapHelper.GetFacingVector(tilePositionObject.GetPivotTilePosition(), hexDirectionObject.GetTileFacing()) * centerOffset);
     triangle.color     = HexMapUI.GetLevelColor(tilePositionObject.GetPivotTileLevel());
     transform.rotation = HexMapHelper.GetRotationFromFacing(tilePositionObject.GetPivotTilePosition(), hexDirectionObject.GetTileFacing());
 }
コード例 #2
0
    private CommandPointFsm InstantiateCommandPoint(TileWithFacing tileVec, int level, int endVelocity)
    {
        CommandPointFsm commandPoint = GameObject.Instantiate(commandPointPrefab, transform.position, transform.rotation, transform).GetComponent <CommandPointFsm>();

        commandPoint.SetNavigationSystem(this);

        commandPoint.SetSource(pieceController.worldModel.transform.position, HexMapHelper.GetFacingVector(pieceController.gamePiece.currentTile, pieceController.gamePiece.currentTileFacing));
        commandPoint.SetDestination(tileVec.position, tileVec.facing, level);
        commandPoint.SetEndVelocity(endVelocity);
        if (!pieceController.isPlayerControlled)
        {
            commandPoint.gameObject.SetActive(false);
        }

        availableCommandPoints.Add(commandPoint);
        return(commandPoint);
    }
コード例 #3
0
    public void SetDestination(TileCoords tileCoords, TileCoords facingTile, int level)
    {
        destinationTile       = tileCoords;
        destinationFacingTile = facingTile;
        destinationLevel      = level;

        //Position the sprite within the Hex
        sprite.transform.position = HexMapHelper.GetWorldPointFromTile(tileCoords, level) + ((HexMapHelper.GetFacingVector(tileCoords, facingTile) * HexMapHelper.HexWidth * 0.3f));

        //Face the sprite the correct direction
        sprite.transform.rotation = HexMapHelper.GetRotationFromFacing(tileCoords, facingTile);

        //Color the sprite based on height
        sprite.GetComponentInChildren <SpriteRenderer>().color = HexMapUI.GetLevelColor(level);

        SetSpline(sourcePosition, sourceHeading,
                  HexMapHelper.GetWorldPointFromTile(tileCoords, level), HexMapHelper.GetFacingVector(tileCoords, facingTile));
    }