Added Warehouse

This commit is contained in:
DerTyp187
2021-10-02 16:08:14 +02:00
parent 3ec6bdf26d
commit 75a6f34ece
19 changed files with 847 additions and 489 deletions

View File

@@ -6,7 +6,10 @@ public abstract class BuildingBlueprint : MonoBehaviour
{
public bool isColliding;
public GameObject constructionPrefab;
public Material collisionMat;
public Material blueprintMat;
private GameObject terrain;
private Canvas hud;

View File

@@ -3,7 +3,10 @@ guid: 76f9b3b57e22ab047b8f95bcb552289a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
defaultReferences:
- constructionPrefab: {instanceID: 0}
- collisionMat: {fileID: 2100000, guid: a1e8fb1ea637c0e45bed70dd7d1feaab, type: 2}
- blueprintMat: {fileID: 2100000, guid: 78d3985cb7b88204b930cd05567c0c61, type: 2}
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -5,8 +5,7 @@ using UnityEngine;
public class HouseBlueprint : BuildingBlueprint
{
public Material collisionMat;
public Material blueprintMat;
private Transform houseCube;

View File

@@ -4,8 +4,6 @@ using UnityEngine;
public class HouseConstruction : BuildingConstruction
{
private GameObject gameManager;
[Header("Needed Resources")]
[SerializeField] private int neededWood = 10;

View File

@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WarehouseBlueprint : BuildingBlueprint
{
private MeshRenderer[] childrenMeshRenderer;
public override void Init()
{
//Haus cube <20>m Obj -> hier wird es benutzt zum material <20>ndern
childrenMeshRenderer = gameObject.GetComponentsInChildren<MeshRenderer>();
}
public override void WhileColliding()
{
//Wenn es collidet soll der HouseCube IM Object ver<65>ndert werden!
//Das ist bei jedem Building anders
foreach(MeshRenderer r in childrenMeshRenderer)
{
r.material = collisionMat;
}
}
public override void WhileNotColliding()
{
//Das selbe wie bei "WhileColliding"
foreach (MeshRenderer r in childrenMeshRenderer)
{
r.material = blueprintMat;
}
}
}

View File

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

View File

@@ -7,6 +7,8 @@ public class WarehouseBuilding : StorageBuilding
private void Start()
{
title = "Warehouse";
description = "A place to store your resources";
inventorySpace = 500;
}

View File

@@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WarehouseConstruction : BuildingConstruction
{
[Header("Needed Resources")]
[SerializeField] private int neededWood = 10;
[Header("Having Resources")]
[SerializeField] private int havingWood = 0;
public override void Init()
{
}
public override bool CheckForResources()
{
if (havingWood == neededWood)
{
return true;
}
return false;
}
}

View File

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

View File

@@ -7,9 +7,12 @@ public class StorageBuilding : Building
[SerializeField] private List<Item> inventory = new List<Item>();
public int inventorySpace;
public void Start()
public void Awake()
{
buildingType = BuildingType.Storage;
}
public void Add(Item item)
{