updated building.cs, buildingContruction.cs, buildingBlueprint.cs

This commit is contained in:
DerTyp187
2021-09-25 22:54:18 +02:00
parent 880e5a2424
commit 7af73ae68b
42 changed files with 1629 additions and 833 deletions

View File

@@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HouseBlueprint : BuildingBlueprint
{
public Material collisionMat;
public Material blueprintMat;
private Transform houseCube;
public override void Init()
{
houseCube = gameObject.transform.Find("HouseCube");
}
public override void WhileColliding()
{
houseCube.GetComponent<MeshRenderer>().material = collisionMat;
}
public override void WhileNotColliding()
{
houseCube.GetComponent<MeshRenderer>().material = blueprintMat;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d49e2868fa536c4fac8ec278501f38b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HouseBuildingScript : Building
{
[SerializeField] private string title = "House";
[SerializeField] private string description = "A place for people to live in.";
public override string GetTitle()
{
return title;
}
public override string GetDescription()
{
return description;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 255558bfba6648641822c24b4555e7db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HouseConstruction : BuildingConstruction
{
private GameObject gameManager;
[Header("Needed Resources")]
[SerializeField] private int neededWood = 10;
[Header("Having Resources")]
[SerializeField] private int havingWood = 0;
public override void Init()
{
gameManager = GameObject.Find("GameManager");
gameManager.GetComponent<EventLog>().CreateEvent("Construction: House");
}
public override bool CheckForResources()
{
if (havingWood == neededWood)
{
gameManager.GetComponent<EventLog>().CreateEvent("Construction: House: finished");
return true;
}
return false;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b49d2e0b5f1b960469b9dc34355fcc5f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: