GlobalGameJam-2021/Assets/Scripts/SubDamageObjectScript.cs
2021-01-30 13:51:35 +01:00

32 lines
724 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SubDamageObjectScript : MonoBehaviour
{
private DamageObjectsManager damageObjectManager;
void Start()
{
damageObjectManager = GetComponentInParent<DamageObjectsManager>();
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerStay(Collider other)
{
if (damageObjectManager.objectType == DamageObjectsManager.ObjectType.HideSpikes)
{
if (other.gameObject.tag == "Player")
{
damageObjectManager.damagePlayer(other.gameObject.GetComponent<PlayerManager>());
}
}
}
}