Commit 72dcb273 by alsunj

Merge branch 'main' into feat/Enemy-shoot-player

parents 410d949f ff7c4a5e
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="SqlMultipleLimitClausesInspection" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
\ No newline at end of file
fileFormatVersion: 2
guid: 9605dbac431a2944dba3a44fd31376bd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -2,9 +2,9 @@ using DG.Tweening;
using Unity.Netcode;
using UnityEngine;
public class Barrel : NetworkBehaviour, IDestrucable
public class Barrel : NetworkBehaviour, IDamagable
{
[SerializeField] private DestructableSettings _destructableSettings;
[SerializeField] private DamagableSettings _destructableSettings;
private readonly NetworkVariable<float> _health = new NetworkVariable<float>();
......
using UnityEngine;
public class Damagable : MonoBehaviour, IDamagable
{
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void TakeDamage(float damage)
{
throw new System.NotImplementedException();
}
}
fileFormatVersion: 2
guid: 48cdea45b63a28f4f9be35332b8382cd
\ No newline at end of file
using UnityEngine;
[CreateAssetMenu(fileName = "DestructableSettings", menuName = "Scriptable Objects/DestructableSettings")]
public class DestructableSettings : ScriptableObject
[CreateAssetMenu(fileName = "DamagableSettings", menuName = "Scriptable Objects/DestructableSettings")]
public class DamagableSettings : ScriptableObject
{
public float health = 20f;
public float hitDelay = 1f;
......
using UnityEngine;
public interface IDestrucable
public interface IDamagable
{
void TakeDamage(float damage);
}
\ No newline at end of file
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Serialization;
public class Explosive : Pickupable, IExplosive
{
private ExplosiveSettings _explosiveSettings;
[SerializeField] private ExplosiveSettings explosiveSettings;
private BoxCollider _boxCollider;
private Rigidbody _rigidbody;
private void Awake()
private void Start()
{
_boxCollider = GetComponent<BoxCollider>();
_rigidbody = GetComponent<Rigidbody>();
}
public void Explode()
{
throw new System.NotImplementedException();
Collider[] hitColliders = Physics.OverlapSphere(transform.position, explosiveSettings.explosionRadius, explosiveSettings.explosionLayerMask);
foreach (var hitCollider in hitColliders)
{
}
}
public void Throw(Vector3 throwDirection)
{
_rigidbody.isKinematic = false;
_rigidbody.AddForce(throwDirection * explosiveSettings.throwForce, ForceMode.VelocityChange);
}
public override void Pickup()
......
......@@ -3,5 +3,9 @@ using UnityEngine;
[CreateAssetMenu(fileName = "ExplosiveSettings", menuName = "Scriptable Objects/ExplosiveSettings")]
public class ExplosiveSettings : ScriptableObject
{
public float explosionRadius = 3f;
public float explosionForce = 10f;
public float explosionDamage = 10f;
public float throwForce = 10f;
public LayerMask explosionLayerMask;
}
......@@ -3,4 +3,5 @@ using UnityEngine;
public interface IExplosive
{
public void Explode();
public void Throw(Vector3 throwDirection);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment