/// ---------------------------------------------
/// Behavior Designer
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.BehaviorDesigner.Samples
{
using UnityEngine;
using UnityEngine.AI;
///
/// Controlling logic on the Save Load Agent.
///
public class SaveLoadAgent : MonoBehaviour
{
[Tooltip("A reference to the muzzle flash.")]
[SerializeField] protected GameObject m_MuzzleFlashPrefab;
[Tooltip("The location the muzzle flash should spawn.")]
[SerializeField] protected GameObject m_MuzzleFlashSpawnLocation;
[Tooltip("The index of the animator when the agent dies.")]
[SerializeField] protected int m_DeathStateIndex;
///
/// Fires the weapon.
///
///
public void Fire(GameObject target)
{
// Instant killshot.
target.GetComponent().SetInteger("State", m_DeathStateIndex);
target.GetComponent().isStopped = true;
target.GetComponent().Value = 0;
if (m_MuzzleFlashPrefab != null) {
GameObject.Instantiate(m_MuzzleFlashPrefab, m_MuzzleFlashSpawnLocation.transform.position, m_MuzzleFlashSpawnLocation.transform.rotation);
}
}
}
}