to new git

This commit is contained in:
2022-05-04 23:50:07 +07:00
parent 290f5515b7
commit c8af0e5284
39 changed files with 720 additions and 359 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -1,7 +1,6 @@
using System;
using UnityEngine;
using UnityEngine;
public interface IPickable
{
PickUpType type { get; }
PickUpType type { get; }
void PickObject(GameObject obj);
}

View File

@ -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)
{