- Necromancer class playable - Savage minion ability & npc - Mage minion ability & npc - rogue minion ability & npc - warrior minion ability & npc - golem minion ability & npc - minion abilities - Class resource (used to automatically summon minions based on the amount of souls drained, in case of necromancer) - class resource spender (auto cast from priority list) - class resource regen instant effect option
95 lines
2.0 KiB
C#
95 lines
2.0 KiB
C#
using Photon.Pun;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class MinionNPCController : BasicEnemyNPCController
|
|
{
|
|
protected bool isReady = false;
|
|
|
|
protected override void Start()
|
|
{
|
|
base.Start();
|
|
isReady = false;
|
|
}
|
|
|
|
public virtual void OnSummonAnimationEnded()
|
|
{
|
|
isReady = true;
|
|
}
|
|
|
|
protected override void Update()
|
|
{
|
|
if (!photonView.IsMine) return;
|
|
if (isDead) return;
|
|
if (!isReady)
|
|
{
|
|
SetAgentMoving(false);
|
|
return;
|
|
}
|
|
|
|
counter += Time.deltaTime;
|
|
|
|
if (HasTarget())
|
|
{
|
|
ChasingUpdate();
|
|
}
|
|
else
|
|
{
|
|
PatrollingUpdate();
|
|
}
|
|
}
|
|
|
|
protected override void PatrollingUpdate()
|
|
{
|
|
if (!HasAvailableTargets())
|
|
{
|
|
if (currentTarget != null)
|
|
{
|
|
currentTarget = null;
|
|
}
|
|
if (agent.destination == null)
|
|
{
|
|
PatrolNewPosition();
|
|
}
|
|
else if (agent.remainingDistance < distanceToChangePatrolDestination)
|
|
{
|
|
PatrolNewPosition();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
FollowOwner();
|
|
}
|
|
}
|
|
|
|
protected virtual void FollowOwner()
|
|
{
|
|
agent.speed = patrolAgentSpeed;
|
|
patrolDestination = ((RiftPlayer)photonView.Owner.TagObject).transform.position;
|
|
patrolDestination.y = 0f;
|
|
UpdatePatrolTarget(patrolDestination);
|
|
SetAgentMoving(true);
|
|
}
|
|
|
|
[PunRPC]
|
|
protected override void RPC_OnDeath(bool lootDropped)
|
|
{
|
|
if (isDead) return;
|
|
|
|
Debug.Log($"{this.gameObject.name} died!");
|
|
|
|
isDead = true;
|
|
|
|
agent.enabled = false;
|
|
|
|
//experienceOnDeath.Raise(health.GetMaxValue() * GameConstants.GameBalancing.HealthIntoExperienceMultiplier);
|
|
|
|
//dropTable.DropLoot(lootDropped);
|
|
|
|
animatorController.SetDead();
|
|
|
|
if (!photonView.IsMine) return;
|
|
}
|
|
}
|