68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
using Kryz.CharacterStats.Examples;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class RiftPlayer : MonoBehaviour
|
|
{
|
|
[Header("Class:")]
|
|
public GameTag classTag;
|
|
[Header("Events:")]
|
|
[SerializeField] private GameEvent_RiftPlayer onPlayerSpawned;
|
|
[SerializeField] private GameEvent_RiftPlayer onPlayerDeath;
|
|
|
|
[HideInInspector]
|
|
public PlayerCharacterStats character;
|
|
|
|
public Transform projectileSpawnLocation;
|
|
|
|
[HideInInspector]
|
|
public Health health;
|
|
[HideInInspector]
|
|
public Mana mana;
|
|
[HideInInspector]
|
|
public ClassResource classResource;
|
|
[HideInInspector]
|
|
public SpiritPower spiritPower;
|
|
[HideInInspector]
|
|
public AbilityCooldownTracker abilityCooldownTracker;
|
|
|
|
public Taggable playerTag;
|
|
|
|
PlayerDeathManager playerDeathManager;
|
|
|
|
private void Awake()
|
|
{
|
|
character = GetComponent<PlayerCharacterStats>();
|
|
playerDeathManager = GetComponentInChildren<PlayerDeathManager>();
|
|
abilityCooldownTracker = GetComponentInChildren<AbilityCooldownTracker>();
|
|
health = GetComponent<Health>();
|
|
mana = GetComponent<Mana>();
|
|
spiritPower = GetComponent<SpiritPower>();
|
|
classResource = GetComponent<ClassResource>();
|
|
playerTag = GetComponent<Taggable>();
|
|
|
|
health.onDeath.AddListener(OnDeath);
|
|
}
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
onPlayerSpawned.Raise(this);
|
|
|
|
this.gameObject.name = PlayerDataHandler.Instance.currentCharacterName.Value;
|
|
}
|
|
|
|
|
|
private void OnDeath()
|
|
{
|
|
RPC_OnDeath();
|
|
}
|
|
|
|
private void RPC_OnDeath()
|
|
{
|
|
onPlayerDeath.Raise(this);
|
|
}
|
|
|
|
}
|