39 lines
856 B
C#
39 lines
856 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DarkTonic.MasterAudio;
|
|
using DragonLi.Core;
|
|
using Mirror;
|
|
using UnityEngine;
|
|
|
|
public enum ExplosionType
|
|
{
|
|
PistolEx=0,
|
|
SmokeEx=1,
|
|
ShieldEx=2,
|
|
}
|
|
public class Explosion : NetworkBehaviour
|
|
{
|
|
[SoundGroup] public string explosionSound;
|
|
public ExplosionType type;
|
|
public virtual void OnSpawn(float curDurationTime)
|
|
{
|
|
if (isClient)
|
|
{
|
|
MasterAudio.PlaySound3DAtVector3(explosionSound, transform.position);
|
|
}
|
|
|
|
switch (type)
|
|
{
|
|
case ExplosionType.PistolEx:
|
|
curDurationTime = 5;
|
|
break;
|
|
}
|
|
|
|
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
|
{
|
|
NetworkServer.Destroy(gameObject);
|
|
}, curDurationTime);
|
|
}
|
|
}
|