shaoxiadiablo/Assets/AGame/Scripts/Game/Entity/EntityPlayer.General.cs

174 lines
4.6 KiB
C#
Raw Normal View History

2025-05-18 01:04:31 +08:00
// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2020-09-02
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
// <copyright file= "Cha_Control.General" company="Kimch"></copyright>
// <summary></summary>
// ***********************************************************************
using UnityEngine;
namespace G
{
partial class EntityPlayer
{
[Header("副将")]
public int g_hp;
public int g_atk;
public Transform dummy_general;
private AudioClip[] g_yell = new AudioClip[2];
private AudioClip[] g_skillyell = new AudioClip[2];
public bool isGeneral
{
get;
private set;
}
private int general_kind;
private int general_weapon;
private int g_maxhp;
private int g_def;
private float g_atkspd;
public void Set_General(short _weapon, short _kind, short _maxhp, short _maxatk, short _def, float _atkspd, short _unique, int _hp, short _voice)
{
general_weapon = _weapon;
general_kind = _kind;
g_maxhp = _maxhp;
g_atk = _maxatk;
g_def = _def;
g_atkspd = _atkspd;
g_hp = _hp;
dummy_general.GetComponent<General_dummy>().SetCostume(general_kind, general_weapon);
if (general_kind == 1)
{
dummy_general.localScale = Vector3.one * 1.4f;
}
else if (general_kind == 3)
{
dummy_general.localScale = Vector3.one * 1.1f;
}
//if (accessory[3] > 0)
//{
// g_atk = (short)(g_atk * 1.1f);
//}
g_yell[0] = Resources.Load<AudioClip>("general_yell" + _voice + "a");
g_yell[1] = Resources.Load<AudioClip>("general_yell" + _voice + "b");
g_skillyell[0] = Resources.Load<AudioClip>("general_skillyell" + _voice + "a");
g_skillyell[1] = Resources.Load<AudioClip>("general_skillyell" + _voice + "b");
}
public void GeneralOnOff(bool _general, short dead)
{
if (dead == 0)
{
SpCharge(-10f);
}
isGeneral = _general;
_changeCha = true;
StopAnimation();
GameCamera.Instance.ZoomIn(3, 16, 0.5f);
transform.localScale = Vector3.one;
if (!isGeneral)
{
scriptSound.PlayYell(0);
_specialKind = _specialKindOrigin;
//script_cam.IconHideStop(false);
scriptWeapon.GeneralWeaponOff();
//attack = attackOrigin;
//hitrate = hitrateOrigin;
//defence = defenceOrigin;
_attackSpeed = _attackSpeedOrigin;
if (moveState < MoveState.state10_Atk_T && moveState >= MoveState.state0_Idle)
{
PlayAnimation(Hash_Change_In);
//PlayAnim("change_in");
}
else
{
PlayAnimation("change_in_atk");
//temp_attack = PlayAnimQueued(ATK_1T, QueueMode.CompleteOthers);
//temp_attack.speed = 0.24f;
//temp_attack.layer = 1;
ef_swing_ex1.localScale = Vector3.one * 2f;
ef_swing_ex1.localRotation = Quaternion.Euler(0f, 0f, 180f);
ef_swing_ex1.position = transform.position + Vector3.up * 0.055f;
_scriptSwingEx1.SwingOn(0.6f, 2, 2, 20, 1, 120);
scriptAttack.ResetStep();
}
dummy_general.position = transform.position;
dummy_general.rotation = transform.rotation;
ChangeCharacter(_weaponKind);
if (dead == 0)
{
dummy_general.GetComponent<General_dummy>().ShowOut();
}
else
{
dummy_general.GetComponent<General_dummy>().Dead();
script_ui.GeneralDead();
_changeCha = false;
moveState = 0;
Invincibility(1f);
}
//GetComponent<Cha_Costume>().ResetCostume();
}
else
{
//scriptSound.PlaySound(g_yell[0]);
_specialKind = -1;
//script_cam.IconHideStop(true);
isGeneral = true;
maxHp = g_maxhp;
//attack = g_atk;
//hitrate = 100;
//defence = g_def;
_attackSpeed = g_atkspd;
curHp = g_hp;
if (dead == 0)
{
PlayAnimation(Hash_Change_Out);
//PlayAnim("change_out");
}
else
{
Died();
}
if (moveState > MoveState.state10_Atk_T || moveState < MoveState.state0_Idle)
{
ef_swing_ex1.localScale = Vector3.one * 2f;
ef_swing_ex1.localRotation = Quaternion.Euler(0f, 0f, 180f);
ef_swing_ex1.position = transform.position + Vector3.up * 0.055f;
_scriptSwingEx1.SwingOn(0.6f, 2, 2, 20, 1, 120);
scriptAttack.ResetStep();
dummy_general.GetComponent<General_dummy>().ShowIn_atk();
}
else
{
dummy_general.GetComponent<General_dummy>().ShowIn();
}
dummy_general.position = transform.position;
dummy_general.rotation = transform.rotation;
ChangeCharacter(general_kind + 1);
}
//Weapon_Special();
moveState = MoveState.Generalstate100;
UpdateHpBar();
}
}
}