This commit is contained in:
Kotrba Filip
2020-02-01 18:17:29 +01:00
parent 2eb33f9e19
commit 5f189178bc
30 changed files with 7551 additions and 237 deletions

View File

@@ -4,7 +4,7 @@ using UnityEngine;
public class BlockManager : MonoBehaviour
{
public enum BlockType {None, Barricade, Door, Wood, Ammo};
public enum BlockType {None, Barricade, Door, Wood, Ammo, FireCamp};
public BlockType blockType = BlockType.None;
public float health = 100;
public float healthRate = 5;

View File

@@ -179,4 +179,13 @@ public class EnemyManager : MonoBehaviour
Damage();
}
}
void OnTriggerEnter(Collider collider)
{
if (collider.transform.CompareTag("Meele"))
{
Damage();
}
}
}

View File

@@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GuiManager : MonoBehaviour
{
public GameObject InteractIcon;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void InteractVerifier(bool set)
{
InteractIcon.SetActive(set);
}
}

View File

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

View File

@@ -20,6 +20,7 @@ public class PlayerManager : MonoBehaviour
public int barricadeMaterials = 10;
public List<GameObject> weaponList = new List<GameObject>();
private GameObject createWeapon;
public GuiManager guiManager;
[HideInInspector]public int selectedWeapon = 0;
@@ -182,6 +183,14 @@ public class PlayerManager : MonoBehaviour
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 2))
{
if (hit.transform.CompareTag("BarricadeField") || hit.transform.CompareTag("Interact"))
{
guiManager.InteractVerifier(true);
}
else
{
guiManager.InteractVerifier(false);
}
if (Input.GetAxisRaw("Build") > 0 && buildTime < Time.time && barricadeMaterials > 0 && hit.transform.tag == "BarricadeField")
{
BarricadeManager barricadeManager = hit.transform.GetComponent<BarricadeManager>();
@@ -199,5 +208,9 @@ public class PlayerManager : MonoBehaviour
}
}
else
{
guiManager.InteractVerifier(false);
}
}
}

View File

@@ -12,6 +12,8 @@ public class WeaponManager : MonoBehaviour
public float damage = 0;
public float fireRate = 0.5f;
private float fireTime;
public Animator animator;
public bool hit = false;
// Start is called before the first frame update
void Start()
@@ -38,9 +40,19 @@ public class WeaponManager : MonoBehaviour
}
else if (weaponType == WeaponType.Meele)
{
animator.ResetTrigger("Hit");
animator.SetTrigger("Hit");
}
fireTime = fireRate + Time.time;
}
}
void Hit_Enemy_Start()
{
hit = true;
}
void Hit_Enemy_End()
{
hit = false;
}
}