Pedro Gomes e1081a2bf4 Necromancer and Minions update
- 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
2024-07-22 16:46:13 +01:00

71 lines
1.8 KiB
C#

using Kryz.CharacterStats.Examples;
using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RiftPlayer : MonoBehaviour
{
[Header("Class:")]
public GameTag classTag;
[Header("Events:")]
[SerializeField] private GameEvent_PhotonView onPlayerSpawned;
[SerializeField] private GameEvent_Player onPlayerDeath;
[HideInInspector]
public PhotonView photonView;
[HideInInspector]
public PlayerCharacterStats character;
public Transform projectileSpawnLocation;
[HideInInspector]
public Health health;
[HideInInspector]
public Mana mana;
[HideInInspector]
public ClassResource classResource;
[HideInInspector]
public AbilityCooldownTracker abilityCooldownTracker;
PlayerDeathManager playerDeathManager;
private void Awake()
{
photonView = GetComponent<PhotonView>();
character = GetComponent<PlayerCharacterStats>();
playerDeathManager = GetComponentInChildren<PlayerDeathManager>();
abilityCooldownTracker = GetComponentInChildren<AbilityCooldownTracker>();
health = GetComponent<Health>();
mana = GetComponent<Mana>();
classResource = GetComponent<ClassResource>();
health.onDeath.AddListener(OnDeath);
}
// Start is called before the first frame update
void Start()
{
this.photonView.Owner.TagObject = this;
onPlayerSpawned.Raise(this.photonView);
this.gameObject.name = photonView.Owner.NickName;
}
private void OnDeath()
{
if (!photonView.IsMine) return;
photonView.RPC(nameof(RPC_OnDeath), RpcTarget.All);
}
[PunRPC]
private void RPC_OnDeath()
{
onPlayerDeath.Raise(photonView.Owner);
}
}