Made the Slime Spawn on Network

- Debuffs don't apply properly yet
This commit is contained in:
2022-03-23 14:02:40 -05:00
parent 80f76a30ff
commit e0f5db1f8a
12 changed files with 1056 additions and 39 deletions

View File

@@ -1,6 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MLAPI;
using MLAPI.Messaging;
public class Goo : MonoBehaviour
{
@@ -9,7 +11,7 @@ public class Goo : MonoBehaviour
void FixedUpdate() {
Lifetime++;
if(Lifetime == 850) {
Destruction();
DespawnMyselfServerRPC();
}
}
@@ -22,7 +24,8 @@ public class Goo : MonoBehaviour
}
}
void Destruction() {
Destroy(gameObject);
[ServerRpc(RequireOwnership = false)]
private void DespawnMyselfServerRPC() {
this.gameObject.GetComponent<NetworkObject>().Despawn(true);
}
}