2021년 4학년 1학기 기업연계프로젝트2 컴퓨터소프트웨어공학과 <원광투어팀> 팀장 : 송유진 팀원 : 김나영, 이경희, 한유진
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

34 lines
1011 B

using Unity.FPS.Game;
using UnityEngine;
namespace Unity.FPS.Gameplay
{
[RequireComponent(typeof(Collider))]
public class ObjectiveReachPoint : Objective
{
[Tooltip("Visible transform that will be destroyed once the objective is completed")]
public Transform DestroyRoot;
void Awake()
{
if (DestroyRoot == null)
DestroyRoot = transform;
}
void OnTriggerEnter(Collider other)
{
if (IsCompleted)
return;
var player = other.GetComponent<PlayerCharacterController>();
// test if the other collider contains a PlayerCharacterController, then complete
if (player != null)
{
CompleteObjective(string.Empty, string.Empty, "Objective complete : " + Title);
// destroy the transform, will remove the compass marker if it has one
Destroy(DestroyRoot.gameObject);
}
}
}
}