RiftMayhem/Assets/Scripts/NPC/NPCControllers_v2/NPCAnimatorControllerBase.cs
Pedro Gomes bc4019ffdf Necromancer updates & bugfix
- Added Necromancer ultimate ability (Summon Golem)
- Updated and bugfixed golem minion
- Added New slam ability for golem
- Bugfixed damage over time effect calculate final damage when owner no longer exists
- Fixed an issue causing items to be vendored even with vendor closed
2024-07-23 21:26:32 +01:00

80 lines
2.1 KiB
C#

using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class NPCAnimatorControllerBase : MonoBehaviour
{
protected Animator anim;
protected NavMeshAgent agent;
protected PhotonView photonView;
protected NPCControllerBase npcController;
protected bool isLockedInAnimation = false;
protected virtual void Awake()
{
anim = GetComponent<Animator>();
agent = GetComponentInParent<NavMeshAgent>();
photonView = GetComponentInParent<PhotonView>();
npcController = GetComponentInParent<NPCControllerBase>();
}
protected virtual void Start()
{
}
protected void Update()
{
if (!photonView.IsMine) return;
anim.SetFloat("movementSpeed", agent.velocity.magnitude);
}
protected virtual void OnAttackAnimationEvent()
{
if (!photonView.IsMine) return;
Debug.Log("Sending Notice On Attack Animation Event Trigger");
//send notice for brain/abilitybinder to execute queued action/ability
npcController.OnAttackAnimationEventTriggered();
}
protected virtual void OnDeathAnimationEvent()
{
if (!photonView.IsMine) return;
//send notice for brain/abilitybinder to execute queued action/ability
npcController.OnDeathAnimationEventTriggered();
}
public void SetDead()
{
anim.SetTrigger("dead");
}
public virtual void SetTriggerBasedOnAbility(AbilityAnimationType animationType)
{
Debug.Log("Setting animation trigger = " + animationType);
switch (animationType)
{
case AbilityAnimationType.Throw:
anim.SetTrigger("throw");
break;
case AbilityAnimationType.Spell:
anim.SetTrigger("cast");
break;
case AbilityAnimationType.Melee:
anim.SetTrigger("melee");
break;
case AbilityAnimationType.Jump:
anim.SetTrigger("jump");
break;
default:
break;
}
}
}