コード例 #1
0
ファイル: TargetCursor.cs プロジェクト: PyotrRomanov/LD41
 public void Setup(Player player, bool[,] mask, TargetedMetaAction action, ActionInfo actionInfo, KeyCode keyPressed)
 {
     this.position   = player.position;
     this.mask       = mask;
     this.board      = player.board;
     this.player     = player;
     this.action     = action;
     this.actionInfo = actionInfo;
     this.keyPressed = keyPressed;
     this.GetComponent <Transform>().position    = board.tiles[position.x, position.y].GetComponent <GridTile>().Center();
     this.GetComponent <Transform>().localScale *= board.world.scale;
     this.GetComponent <SpriteRenderer>().color  = Colors.cursorColor;
     board.MarkTiles(mask, Colors.cursorSelectableColor);
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: PyotrRomanov/LD41
    private void TargetPhase(MetaAction metaAction, KeyCode keyPressed)
    {
        ActionInfo actionInfo = new ActionInfo();

        if (metaAction is TargetedMetaAction)
        {
            TargetedMetaAction targetAction = metaAction as TargetedMetaAction;
            GameObject         cursor       = Instantiate((GameObject)Resources.Load(Player.cursorPf));
            actionInfo.originId  = this.id;
            actionInfo.originPos = this.position;
            cursor.GetComponent <TargetCursor>().Setup(this, targetAction.PotentialTargets(board, actionInfo), targetAction, actionInfo, keyPressed);
            selectActionPhase = false;
        }
        else
        {
            actionInfo.originId  = this.id;
            actionInfo.originPos = this.position;
            actionInfo.targetId  = World.InvalidId;
            actionInfo.targetPos = Board.InvalidPos;
            EndTargetPhase(metaAction, actionInfo);
        }
    }