120 lines
2.4 KiB
C#
120 lines
2.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DarkTonic.MasterAudio;
|
|
using DragonLi.Core;
|
|
using JetBrains.Annotations;
|
|
using Mirror;
|
|
using UnityEngine;
|
|
using Valheim;
|
|
|
|
public class LittleFish : Fish
|
|
{
|
|
public GameObject waterEffect;
|
|
|
|
/// <summary>
|
|
/// 蓄力攻击效果
|
|
/// </summary>
|
|
public GameObject ChargeAttackEffect;
|
|
|
|
/// <summary>
|
|
/// 发射子弹效果
|
|
/// </summary>
|
|
public GameObject FireAttackEffect;
|
|
|
|
[SoundGroup] public string fireSound;
|
|
|
|
private float tempRaius;
|
|
|
|
public Transform Model;
|
|
public void Start()
|
|
{
|
|
tempRaius = radius;
|
|
}
|
|
|
|
|
|
public override void Die(object info, Transform _sender)
|
|
{
|
|
base.Die(info, _sender);
|
|
}
|
|
|
|
|
|
|
|
[Server]
|
|
public void ShowEffect()
|
|
{
|
|
RpcCreateWaterEffect();
|
|
}
|
|
|
|
[ClientRpc]
|
|
public void RpcCreateWaterEffect()
|
|
{
|
|
GameObject water = Instantiate(waterEffect);
|
|
water.transform.position = new Vector3(transform.position.x, 0.05F, transform.position.z);
|
|
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
|
{
|
|
Destroy(water);
|
|
}, 5F);
|
|
}
|
|
|
|
public override void AttackOnce()
|
|
{
|
|
base.AttackOnce();
|
|
}
|
|
|
|
[Server]
|
|
public void ChargeAttack()
|
|
{
|
|
if (isServer)
|
|
{
|
|
RpcChargeAttackEffect();
|
|
}
|
|
}
|
|
|
|
[ClientRpc]
|
|
public void RpcChargeAttackEffect()
|
|
{
|
|
ChargeAttackEffect.SetActive(true);
|
|
FireAttackEffect.SetActive(true);
|
|
Debug.Log("怪物攻击");
|
|
//播放射击音效
|
|
Transform current = transform;
|
|
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
|
{
|
|
if (current != null)
|
|
{
|
|
//MasterAudio.PlaySound3DFollowTransform(fireSound, transform);
|
|
}
|
|
}, 1F);
|
|
}
|
|
|
|
[Server]
|
|
public void HideChargeAttack()
|
|
{
|
|
if (isServer)
|
|
{
|
|
RpcHideChargeAttack();
|
|
}
|
|
}
|
|
|
|
[ClientRpc]
|
|
public void RpcHideChargeAttack()
|
|
{
|
|
//ChargeAttackEffect.SetActive(false);
|
|
//FireAttackEffect.SetActive(false);
|
|
}
|
|
|
|
|
|
public override void Update()
|
|
{
|
|
base.Update();
|
|
//NavAgent.radius = tempRaius + ((Model.transform.localScale.x - 1) / 2);
|
|
//radius = NavAgent.radius;
|
|
if (isServer && state == EnemyState.GroundAlert)
|
|
{
|
|
//RpcHideChargeAttack();
|
|
}
|
|
}
|
|
}
|
|
|
|
|