コード例 #1
0
 public Node(int x, int y, int costToGetHere, int estimatedCostToGoal, TerrainTile.MoveType type, int moveCost)
 {
     this.x                   = x;
     this.y                   = y;
     this.costToGetHere       = costToGetHere;
     this.estimatedCostToGoal = estimatedCostToGoal;
     this.Type                = type;
     this.MoveCost            = moveCost;
 }
コード例 #2
0
ファイル: UnitType.cs プロジェクト: greenarchmage/DragonLords
 public UnitType(string name, int strength, int hits, int speed, int order, string spriteName, int price, int productionTurns, TerrainTile.MoveType moveType)
 {
     Name           = name;
     Strength       = strength;
     Hits           = hits;
     Speed          = speed;
     Order          = order;
     SpriteName     = spriteName;
     Price          = price;
     ProdutionTurns = productionTurns;
     MoveType       = moveType;
 }
コード例 #3
0
    private bool CheckOutside(Vector3 pos)
    {
        Unit newUnit = new Unit(CurrentProduction);

        foreach (Stack st in GameController.Instance.CurrentGameData.AllStacks)
        {
            if (st.transform.position == pos)
            {
                if (st.StackData.Units.Count == Constants.StackSize)
                {
                    // The stack is full, skip to next stack
                    // change position
                    return(false);
                }
                else
                {
                    // There is an unfull stack at the position, add new unit to stack
                    st.AddUnit(newUnit);
                    return(true);
                }
            }
        }
        var gameDate = GameController.Instance.CurrentGameData;

        if ((int)pos.x >= gameDate.MapSize || (int)pos.y >= gameDate.MapSize)
        {
            return(false);
        }
        TerrainTile.MoveType currentTile = gameDate.TerrainTiles[(int)pos.x, (int)pos.y].MoveGroup;
        if (currentTile == TerrainTile.MoveType.Impassable ||
            (currentTile == TerrainTile.MoveType.Flying || currentTile == TerrainTile.MoveType.WaterPassable) && CurrentProduction.MoveType != TerrainTile.MoveType.Flying)
        {
            return(false);
        }
        // instantiate new stack at pos
        InstantiateUnit(pos, newUnit);
        return(true);
    }