init
This commit is contained in:
commit
341a877b4a
2338 changed files with 1346408 additions and 0 deletions
33
Assets/Scripts/Player/ProjectileCollisionChecker.cs
Normal file
33
Assets/Scripts/Player/ProjectileCollisionChecker.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ProjectileCollisionChecker : MonoBehaviour
|
||||
{
|
||||
public float colliderScalar = .75f;
|
||||
void Update()
|
||||
{
|
||||
Collider[] colliders = Physics.OverlapBox(transform.position,transform.parent.localScale*colliderScalar, transform.rotation);
|
||||
|
||||
ExtDebug.DrawBox(transform.position, transform.parent.localScale * colliderScalar, transform.rotation, Color.red);
|
||||
|
||||
foreach (Collider c in colliders)
|
||||
{
|
||||
if (c.GetComponent<BulletMovement>() != null)
|
||||
{
|
||||
c.GetComponent<BulletMovement>().bulletHit();
|
||||
GetComponent<PlayerController>().Damage(1);
|
||||
Debug.Log("Player hit");
|
||||
if (GameMaster.Instance.Pooler != null)
|
||||
c.gameObject.SetActive(false);
|
||||
else
|
||||
Destroy(c.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
//void OnDrawGizmos()
|
||||
//{
|
||||
// Gizmos.color = Color.red;
|
||||
// Gizmos.DrawWireCube(transform.position, transform.parent.localScale * colliderScalar);
|
||||
//}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue