Skip to content

Commit

Permalink
last destuctor
Browse files Browse the repository at this point in the history
  • Loading branch information
LEM-II\Ilja committed Jan 22, 2017
1 parent a12b0e0 commit 8df72f5
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
Binary file added GGJ17/Assets/Prefab/Banzaai.prefab
Binary file not shown.
8 changes: 8 additions & 0 deletions GGJ17/Assets/Prefab/Banzaai.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified GGJ17/Assets/Prefab/BuildingBlocks/Building_Barracks.prefab
Binary file not shown.
Binary file modified GGJ17/Assets/Scene/BlockTest.unity
Binary file not shown.
36 changes: 29 additions & 7 deletions GGJ17/Assets/Script/GodView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ public void enableConstructionMode(GameObject prefab)
{
constructionPrefab = prefab;
AbstractBuildingBlock a = prefab.GetComponent<AbstractBuildingBlock>();
if (a is Building_Wall)
if(prefab.tag == "DESTRUCTION")
{
w.HideNodes();
isDestruct = true;
}
else if (a is Building_Wall)
{
w.ShowNodes(true, true);
}
Expand Down Expand Up @@ -45,24 +50,41 @@ IEnumerator MouseLeftClick()
RaycastHit hit;
if (Physics.Raycast(myCam.ScreenPointToRay(Input.mousePosition), out hit))
{
BuildNode node = hit.collider.GetComponent<BuildNode>();
if (node)
if (constructionPrefab)
{
Instantiate(construction, node.GetSpawnPosition(), Quaternion.identity);
BuildNode node = hit.collider.GetComponent<BuildNode>();
if (node)
{
Instantiate(construction, node.GetSpawnPosition(), Quaternion.identity);
}
yield return new WaitForFixedUpdate();
enableConstructionMode(constructionPrefab);
}
else if (isDestruct)
{
AbstractBaseBuilding a = hit.collider.GetComponent<AbstractBaseBuilding>();
if (a)
{
if (a is Building_Flag)
{}
else
{
a.HP = -1;
}
}
}
yield return new WaitForFixedUpdate();
enableConstructionMode(constructionPrefab);
}
}
}
}

public bool isDestruct = true;
IEnumerator MouseRightClick()
{
while (true)
{
yield return new WaitUntil(() => Input.GetMouseButtonDown(1));
constructionPrefab = null;
isDestruct = false;
w.HideNodes();
}
}
Expand Down
Binary file modified GGJ17/ProjectSettings/TagManager.asset
Binary file not shown.

0 comments on commit 8df72f5

Please sign in to comment.