73 lines
1.6 KiB
C#
73 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DarkTonic.MasterAudio;
|
|
using DragonLi.Core;
|
|
using Mirror;
|
|
using UnityEngine;
|
|
using Valheim;
|
|
|
|
public class RemotePet : Pet
|
|
{
|
|
/// <summary>
|
|
/// 发射子弹效果
|
|
/// </summary>
|
|
public GameObject FireAttackEffect;
|
|
|
|
/// <summary>
|
|
/// 蓄力攻击效果
|
|
/// </summary>
|
|
public GameObject ChargeAttackEffect;
|
|
|
|
[SoundGroup] public string fireSound;
|
|
|
|
|
|
[Server]
|
|
public void ChargeAttack()
|
|
{
|
|
if (isServer)
|
|
{
|
|
RpcChargeAttackEffect();
|
|
}
|
|
}
|
|
|
|
[ClientRpc]
|
|
public void RpcChargeAttackEffect()
|
|
{
|
|
//ChargeAttackEffect.SetActive(true);
|
|
FireAttackEffect.SetActive(true);
|
|
|
|
Transform current = transform;
|
|
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
|
{
|
|
if (current != null)
|
|
{
|
|
//MasterAudio.PlaySound3DFollowTransform(fireSound, transform);
|
|
}
|
|
}, 1F);
|
|
}
|
|
|
|
public new void AttackOnce()
|
|
{
|
|
//base.AttackOnce();
|
|
GameObject target = (GameObject)behaviorTree.GetVariable("target").GetValue();
|
|
FireAttackEffect.SetActive(true);
|
|
GameManager.Ins.CreateBullet(id,FireAttackEffect.transform.position,transform,campId,atk,target);
|
|
}
|
|
|
|
[Server]
|
|
public void HideChargeAttack()
|
|
{
|
|
if (isServer)
|
|
{
|
|
RpcHideChargeAttack();
|
|
}
|
|
}
|
|
|
|
[ClientRpc]
|
|
public void RpcHideChargeAttack()
|
|
{
|
|
//ChargeAttackEffect.SetActive(false);
|
|
FireAttackEffect.SetActive(false);
|
|
}
|
|
}
|