to new git
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(BoxCollider))]
|
||||
public class AmmoPickUp : MonoBehaviour, IPickable
|
||||
@ -11,6 +10,11 @@ public class AmmoPickUp : MonoBehaviour, IPickable
|
||||
PickObject(other.gameObject);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Debug.LogWarning("Pooled object was destroyed");
|
||||
}
|
||||
|
||||
public void PickObject(GameObject obj)
|
||||
{
|
||||
obj.GetComponent<ICharacter>()?.GetCharacter.Condition.TakeAmmo(SettingsReader.Instance.GetSettings.AmmunitionPickupAmount);
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(BoxCollider))]
|
||||
public class ArmourPickUp : MonoBehaviour, IPickable
|
||||
@ -11,6 +10,11 @@ public class ArmourPickUp : MonoBehaviour, IPickable
|
||||
PickObject(other.gameObject);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Debug.LogWarning("Pooled object was destroyed");
|
||||
}
|
||||
|
||||
public void PickObject(GameObject obj)
|
||||
{
|
||||
obj.GetComponent<ICharacter>()?.GetCharacter.Condition.GiveArmour(SettingsReader.Instance.GetSettings.ArmourPickupAmount);
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(BoxCollider))]
|
||||
public class HealthPickUp : MonoBehaviour, IPickable
|
||||
@ -11,6 +10,11 @@ public class HealthPickUp : MonoBehaviour, IPickable
|
||||
PickObject(other.gameObject);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Debug.LogWarning("Pooled object was destroyed");
|
||||
}
|
||||
|
||||
public void PickObject(GameObject obj)
|
||||
{
|
||||
obj.GetComponent<ICharacter>()?.GetCharacter.Condition.GiveHealth(SettingsReader.Instance.GetSettings.HealthPickupAmount);
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
public interface IPickable
|
||||
{
|
||||
PickUpType type { get; }
|
||||
PickUpType type { get; }
|
||||
void PickObject(GameObject obj);
|
||||
}
|
@ -44,25 +44,25 @@ public class PickUpSpawner : MonoBehaviour
|
||||
|
||||
private IEnumerator SpawnNewPickUps()
|
||||
{
|
||||
while(true)
|
||||
while (true)
|
||||
{
|
||||
GameObject item;
|
||||
if(IsDisableCheck(out item))
|
||||
if (IsDisableCheck(out item))
|
||||
{
|
||||
yield return new WaitForSeconds(3);
|
||||
if (item != null)
|
||||
{
|
||||
item.transform.position = spawnPoints[Random.Range(0, spawnPoints.Count)].position;
|
||||
item.transform.position = spawnPoints[Random.Range(0, spawnPoints.Count)].Position;
|
||||
item.SetActive(true);
|
||||
}
|
||||
}
|
||||
yield return new WaitForSeconds(2);
|
||||
yield return new WaitForSeconds(2);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsDisableCheck(out GameObject gameobj)
|
||||
{
|
||||
foreach(var pick in pickups)
|
||||
foreach (var pick in pickups)
|
||||
{
|
||||
if (!pick.activeInHierarchy)
|
||||
{
|
||||
|
Reference in New Issue
Block a user