Files
Colosseum/Assets/External/Animations/AnimationGoblinLocomotion/Samples/Scripts/GBL_SampleObjectLockOn.cs
dal4segno 01f9a6573f feat: 보스 스킬 추가 (스윙, 오른손치기2, 점프) 및 외부 애니메이션 추가
- 스윙, 오른손치기2, 점프 FBX 애니메이션 추가
- 각 스킬 데이터, 패턴 데이터, 데미지 이펙트 데이터 추가
- 우수2연타 패턴 삭제 및 오른손치기 스킬 데이터 수정
- BT_TestBoss 보스 AI 업데이트
- AnimationGoblinLocomotion 외부 애니메이션 패키지 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 15:13:53 +09:00

83 lines
3.1 KiB
C#

// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
// available at: https://syntystore.com/pages/end-user-licence-agreement
//
// Sample scripts are included only as examples and are not intended as production-ready.
using UnityEngine;
namespace Synty.AnimationGoblinLocomotion.Samples
{
public class SampleObjectLockOn : MonoBehaviour
{
public Material _highlightMat;
public Material _targetMat;
private Transform _highlightOrb;
private MeshRenderer _meshRenderer;
/// <inheritdoc cref="Start" />
private void Start()
{
_highlightOrb = transform.Find("TargetHighlight");
_meshRenderer = _highlightOrb.GetComponent<MeshRenderer>();
if (_meshRenderer == null)
{
Debug.LogError("This script requires a MeshRenderer component on the GameObject.");
}
}
/// <summary>
/// Adds this object as a potential lock on target if the player is within range of the target.
/// </summary>
/// <param name="otherCollider">The collider to check.</param>
private void OnTriggerEnter(Collider otherCollider)
{
SamplePlayerAnimationController playerAnimationController = otherCollider.GetComponent<SamplePlayerAnimationController>();
// Only interested in player collisions if they have the controller script.
if (playerAnimationController != null)
{
playerAnimationController.AddTargetCandidate(gameObject);
}
}
/// <summary>
/// Removes this object as a potential lock on target if the player is within range of the target.
/// </summary>
/// <param name="otherCollider">The collider to check.</param>
private void OnTriggerExit(Collider otherCollider)
{
SamplePlayerAnimationController playerAnimationController = otherCollider.GetComponent<SamplePlayerAnimationController>();
// Only interested in player collisions if they have the controller script.
if (playerAnimationController != null)
{
playerAnimationController.RemoveTarget(gameObject);
Highlight(false, false);
}
}
/// <summary>
/// Sets the highlight status of this object, and which highlight to use.
/// </summary>
/// <param name="enable">Whether the highlight is enabled on this object; or not.</param>
/// <param name="targetLock">Whether this object is locked on to; or not.</param>
public void Highlight(bool enable, bool targetLock)
{
Material currentMaterial = targetLock ? _targetMat : _highlightMat;
if (_highlightOrb != null)
{
_highlightOrb.gameObject.SetActive(enable);
if (enable)
{
_meshRenderer.material = currentMaterial;
}
}
}
}
}