Skip to content

Commit

Permalink
Merge pull request #18 from GDSourceMakers/Alpha_code
Browse files Browse the repository at this point in the history
Alpha code
  • Loading branch information
dpeter99 committed Dec 25, 2015
2 parents 9e6ec16 + 0ad9de0 commit 5bf35cc
Show file tree
Hide file tree
Showing 56 changed files with 332 additions and 247 deletions.
12 changes: 10 additions & 2 deletions Assets/BasicUtility/TileMap/TileMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,22 @@ public bool HasTileOn(TileVector cor)
/// <returns></returns>
public TileTransform GetTileOn(int x, int y)
{
return tiles[x, y];
if (Inside(x, y))
{
return tiles[x, y];
}
else
{
Debug.LogError("x:" + x + ", y:" + y + "Is not inside the map");
return null;
}
}


/// <summary>
/// Returns the TileTransform of the tile on coordinates
/// </summary>
/// <param name="cor">Coordinates in TileVector</param>
/// <param name="v">Coordinates in TileVector</param>
/// <returns></returns>
public TileTransform GetTileOn(TileVector v)
{
Expand Down
2 changes: 0 additions & 2 deletions Assets/CivMars/Buildings/Chest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public class Chest : BuildingWGUI, IInventory, IBuildable, IRegystratabe, IHasGu
public override void Awake()
{
base.Awake();
Graphicks.SetActive(false);
this.Graphicks.transform.position = Vector3.zero;
}

public void OpenInventory()
Expand Down
2 changes: 0 additions & 2 deletions Assets/CivMars/Buildings/Furnace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ void Update()
public override void Awake()
{
base.Awake();
Graphicks.SetActive(false);
this.Graphicks.transform.position = Vector3.zero;
}

public void OpenInventory()
Expand Down
2 changes: 0 additions & 2 deletions Assets/CivMars/Buildings/MainBuilding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ enum States
public override void Awake()
{
base.Awake();
Graphicks.SetActive(false);
//this.Graphicks.transform.position = Vector3.zero;
}

public void OpenInventory()
Expand Down
2 changes: 0 additions & 2 deletions Assets/CivMars/Buildings/Miner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public class Miner : BuildingWGUI, IInventory, IHasGui, IRegystratabe, IBuildabl
public override void Awake()
{
base.Awake();
Graphicks.SetActive(false);
this.Graphicks.transform.position = Vector3.zero;
}

public void OpenInventory()
Expand Down
2 changes: 0 additions & 2 deletions Assets/CivMars/Buildings/PlanedBuilding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public class PlanedBuilding : BuildingWGUI, ISaveble, IRegystratabe
public override void Awake()
{
base.Awake();
Graphicks.SetActive(false);
this.Graphicks.transform.position = Vector3.zero;
}

void Start()
Expand Down
2 changes: 0 additions & 2 deletions Assets/CivMars/Buildings/Press.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ void Update()
public override void Awake()
{
base.Awake();
Graphicks.SetActive(false);
this.Graphicks.transform.position = Vector3.zero;
}

public void OpenInventory()
Expand Down
7 changes: 1 addition & 6 deletions Assets/CivMars/Items/IronPipe.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CivMarsEngine;
using UnityEngine;
using CivMarsEngine;

namespace CivMars
{
Expand Down
71 changes: 0 additions & 71 deletions Assets/CivMars/Items/Item.cs

This file was deleted.

4 changes: 3 additions & 1 deletion Assets/CivMars/Items/Ore/CoalOre.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CivMars
using CivMarsEngine;

namespace CivMars
{
public class CoalOre : Item
{
Expand Down
4 changes: 3 additions & 1 deletion Assets/CivMars/Items/Ore/IronOre.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CivMars
using CivMarsEngine;

namespace CivMars
{
public class IronOre : Item
{
Expand Down
4 changes: 3 additions & 1 deletion Assets/CivMars/Items/Ore/SandOre.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CivMars
using CivMarsEngine;

namespace CivMars
{
public class SandOre : Item
{
Expand Down
4 changes: 3 additions & 1 deletion Assets/CivMars/Items/Ore/StoneOre.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CivMars
using CivMarsEngine;

namespace CivMars
{
public class StoneOre : Item
{
Expand Down
4 changes: 3 additions & 1 deletion Assets/CivMars/Items/Ore/UraniumOre.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace CivMars
using CivMarsEngine;

namespace CivMars
{
public class UraniumOre : Item
{
Expand Down
15 changes: 7 additions & 8 deletions Assets/CivMars/NeedToBeImplemented/Food.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CivMarsEngine;


public class Food:Item
{
}
namespace CivMars
{

public class Food : Item
{
}
}
10 changes: 2 additions & 8 deletions Assets/CivMars/NeedToBeImplemented/RefrinedUranium.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



public class RefrinedUranium:Item
using CivMarsEngine;
public class RefrinedUranium:Item
{
public string name = "RefrinedUranium";

Expand Down
16 changes: 7 additions & 9 deletions Assets/CivMars/NeedToBeImplemented/Resource.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CivMarsEngine;


public class Resource:Item
{
}
namespace CivMars
{
public class Resource : Item
{
}

}
9 changes: 2 additions & 7 deletions Assets/CivMars/NeedToBeImplemented/Tool.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CivMarsEngine;



public class Tool:Item
public class Tool:Item
{
}

3 changes: 1 addition & 2 deletions Assets/CivMars/Ores/CoalOreTile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ public override void Generate(System.Random r, TileMap map)
base.Generate(r, map);
}


override public void Regystrate()
{
base.ID = this.ID;

chanche = 0;
chanche = 100;
chanche2 = 250;
chancheReduce = 5;
distance = -1;
Expand Down
26 changes: 18 additions & 8 deletions Assets/CivMars/Ores/OreTile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public virtual void Generate(System.Random r, TileMap map)

bool k = map.HasTileOn(pos);

if (r.Next(0,1000) <= chanche && first && k)
if (r.Next(0, 1000) <= chanche && first && k)
{
first = true;
GameObject a = Instantiate(this.gameObject);
Expand All @@ -41,7 +41,7 @@ public virtual void Generate(System.Random r, TileMap map)

a.GetComponent<OreTile>().Spread(r, map, chanche2);
}


}
}
Expand All @@ -57,17 +57,27 @@ public void Spread(System.Random r, TileMap map, float chancheCurrent)
for (int j = -1; j < 2; j++)
{
TileVector pos = transform.position + new TileVector(i, j);
if ((i != 0 || j != 0) && map.Inside(pos) && map.HasTileOn(pos))

bool k = !map.HasTileOn(pos);

if ((i != 0 || j != 0) && map.Inside(pos) && !k)
{
if (r.Next(1000) <= chancheCurrent)
if (r.Next(0, 1000) <= chancheCurrent)
{
GameObject a = Instantiate(this.gameObject);
if (!k)
{
GameObject a = Instantiate(this.gameObject);

a.name = (int.Parse(this.name[0].ToString()) + 1).ToString() + "a";
a.name = (int.Parse(this.name[0].ToString()) + 1).ToString() + "a";

map.SetTile(pos.x, pos.y, a.GetComponent<TileTransform>());
map.SetTile(pos.x, pos.y, a.GetComponent<TileTransform>());

a.GetComponent<OreTile>().Spread(r, map, chancheCurrent - chancheReduce);
a.GetComponent<OreTile>().Spread(r, map, chancheCurrent - chancheReduce);
}
else if(map.GetTileOn(pos.x, pos.y).GetComponent<OreTile>().ID == this.ID)
{
map.GetTileOn(pos.x, pos.y).GetComponent<OreTile>().Spread(r, map, chancheCurrent - chancheReduce);
}
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions Assets/CivMarsEngine/Building.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@ public class Building : Tiled, ISaveble

//public List<Item> buildingMaterials;

public GameObject Graphicks;
public GameObject graphics;
public bool guion;

public override void Awake()
{
base.Awake();
}

public void PositionUpdate()
{
Graphicks.SetActive(false);
this.Graphicks.transform.position = Vector3.zero;
}




Expand Down
Loading

0 comments on commit 5bf35cc

Please sign in to comment.