GlobalGameJam-2021/Assets/Scripts/SubDamageObjectScript.cs

32 lines
724 B
C#
Raw Permalink Normal View History

2021-01-30 12:51:35 +00:00
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>());
}
}
}
}