技能成功升级和使用

This commit is contained in:
wulongxiao 2024-12-24 16:44:04 +08:00
parent 63134db4eb
commit 175b4e6e56
6 changed files with 50 additions and 41 deletions

View File

@ -366,6 +366,7 @@ GameObject:
- component: {fileID: -3836672401185760439} - component: {fileID: -3836672401185760439}
- component: {fileID: 1608620729910401442} - component: {fileID: 1608620729910401442}
- component: {fileID: 7351378797470834992} - component: {fileID: 7351378797470834992}
- component: {fileID: 1061754087244483355}
m_Layer: 0 m_Layer: 0
m_Name: laohu m_Name: laohu
m_TagString: Player m_TagString: Player
@ -418,6 +419,7 @@ MonoBehaviour:
retbutton: {fileID: 0} retbutton: {fileID: 0}
ClosureObj: {fileID: 0} ClosureObj: {fileID: 0}
id: M_H_001 id: M_H_001
Name:
camp: 0 camp: 0
hp: 100 hp: 100
dieIndex: -1 dieIndex: -1
@ -427,6 +429,15 @@ MonoBehaviour:
_Canvas: {fileID: 0} _Canvas: {fileID: 0}
spriteRenderers: {fileID: 0} spriteRenderers: {fileID: 0}
HurtDirectin: 0 HurtDirectin: 0
Quality:
Elements:
Info:
SkillId:
AttackType:
AttackActionType:
AttackCD: 0
CritRate: 0
CriticalHitRateBonus: 0
gold: 10 gold: 10
MaxAttack: 10 MaxAttack: 10
MinAttack: 10 MinAttack: 10
@ -539,3 +550,24 @@ SpriteRenderer:
m_WasSpriteAssigned: 0 m_WasSpriteAssigned: 0
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!114 &1061754087244483355
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8433650275485930554}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b8d04d25bab1a3541925d4cc205ad1d8, type: 3}
m_Name:
m_EditorClassIdentifier:
role: {fileID: 8433650274028726420}
fun: {fileID: 0}
DamageUp: 1
AttackRange: 1
AttackCooldown: 1
AttackDuration: 1
NumberOfBullets: 1
SpeedOfBullets: 1
CritRate: 1

View File

@ -103,6 +103,7 @@ public class SkillBox : Base
obj.GetComponent<Skill_Spend>().infobox_skill_up = infobox_skill; obj.GetComponent<Skill_Spend>().infobox_skill_up = infobox_skill;
obj.GetComponent<Skill_Spend>().MySkill = info.skills[j]; obj.GetComponent<Skill_Spend>().MySkill = info.skills[j];
obj.GetComponent<Skill_Spend>().mengyao = MengyaoInfo.Instance.mengyaoIdToRole[info.temp_id]; obj.GetComponent<Skill_Spend>().mengyao = MengyaoInfo.Instance.mengyaoIdToRole[info.temp_id];
obj.GetComponent<Skill_Spend>().index = j + 1;
} }
break; break;
} }
@ -191,10 +192,4 @@ public class SkillBox : Base
zhanhunicon.DOScale(1f, 0.1f).SetEase(Ease.InBack); zhanhunicon.DOScale(1f, 0.1f).SetEase(Ease.InBack);
}); });
} }
void OnDestroy()
{
//mengyaoRole = null;
}
} }

View File

@ -3,10 +3,10 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class SkillUp : MonoBehaviour public class SkillUp : Fun
{ {
[Header("基类")] public Role role; [Header("基类")] public Role role;
[HideInInspector]public Fun fun;//ÓÃÓÚbuffµÄ´´½¨
[Header("攻击伤害加成倍数")] public float DamageUp=1f; [Header("攻击伤害加成倍数")] public float DamageUp=1f;
[Header("攻击范围加成倍数")] public float AttackRange = 1f; [Header("攻击范围加成倍数")] public float AttackRange = 1f;
[Header("攻击冷却加成倍速")] public float AttackCooldown = 1f; [Header("攻击冷却加成倍速")] public float AttackCooldown = 1f;
@ -71,15 +71,15 @@ public class SkillUp : MonoBehaviour
} }
public virtual void Skill_1_1() { } public virtual void Skill_1_1() { }
public virtual void Skill_1_2() { DamageUp *= 1.15f; } public virtual void Skill_1_2() { DamageUp *= 1.15f; Debug.LogError("使用技能1-2"); }
public virtual void Skill_1_3() { } public virtual void Skill_1_3() { }
public virtual void Skill_1_4() { DamageUp *= 1.35f; } public virtual void Skill_1_4() { DamageUp *= 1.35f; Debug.LogError("使用技能1-4"); }
public virtual void Skill_1_5() { } public virtual void Skill_1_5() { }
public virtual void Skill_2_1() { } public virtual void Skill_2_1() { }
public virtual void Skill_2_2() { DamageUp *= 1.15f; } public virtual void Skill_2_2() { DamageUp *= 1.15f; Debug.LogError("使用技能2-2"); }
public virtual void Skill_2_3() { DamageUp *= 1.35f; } public virtual void Skill_2_3() { }
public virtual void Skill_2_4() { } public virtual void Skill_2_4() { DamageUp *= 1.35f; Debug.LogError("使用技能2-4"); }
public virtual void Skill_2_5() { } public virtual void Skill_2_5() { }
} }

View File

@ -14,6 +14,7 @@ public class laohuSkillUp :SkillUp
public override void Skill_1_1() public override void Skill_1_1()
{ {
base.AttackRange *= 2; base.AttackRange *= 2;
Debug.LogError("使用技能1-1");
} }
/// <summary> /// <summary>
/// 被火焰伤害的敌人有20%概率原地眩晕1秒。射程减少1格 /// 被火焰伤害的敌人有20%概率原地眩晕1秒。射程减少1格
@ -22,10 +23,11 @@ public class laohuSkillUp :SkillUp
{ {
base.AttackRange *= 0.75f; base.AttackRange *= 0.75f;
// 创建一个眩晕 Buff持续1秒20%概率) // 创建一个眩晕 Buff持续1秒20%概率)
Action<Role> decelerationBuff = fun.CreateDecelerationBuff(1f, 0.2f); Action<Role> decelerationBuff = CreateDecelerationBuff(1f, 0.2f);
// 将 Buff 添加到玩家的 storageBuff 列表中 // 将 Buff 添加到玩家的 storageBuff 列表中
role.AddBuff(role.storageBuff,decelerationBuff); role.AddBuff(role.storageBuff,decelerationBuff);
Debug.LogError("使用技能1-3");
} }
/// <summary> /// <summary>
/// 喷火冷却时间减少50%,持续喷火时间减少50% /// 喷火冷却时间减少50%,持续喷火时间减少50%
@ -34,6 +36,8 @@ public class laohuSkillUp :SkillUp
{ {
base.AttackCooldown *= 2; base.AttackCooldown *= 2;
base.AttackDuration *= 0.5f; base.AttackDuration *= 0.5f;
Debug.LogError("使用技能1-5");
} }

View File

@ -41,6 +41,7 @@ public class Skill_Spend : MonoBehaviour
//[HideInInspector] //[HideInInspector]
public GameObject mengyao;//¶ÔÓ¦µÄrole public GameObject mengyao;//¶ÔÓ¦µÄrole
public int index;//技能序号
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
@ -53,12 +54,6 @@ public class Skill_Spend : MonoBehaviour
UpgradeBtn.onClick.AddListener(UpgradeClick); UpgradeBtn.onClick.AddListener(UpgradeClick);
} }
public void Init()
{
}
void UpgradeClick() void UpgradeClick()
{ {
@ -67,10 +62,6 @@ public class Skill_Spend : MonoBehaviour
infobox_skill_up.gameObject.SetActive(true); infobox_skill_up.gameObject.SetActive(true);
} }
void SpendClick() void SpendClick()
{ {
musk.gameObject.SetActive(false); musk.gameObject.SetActive(false);

View File

@ -32,27 +32,16 @@ public class infobox_skill_up : MonoBehaviour
if (Skillspend.levelNumber <Skillspend.Maxlevel && (SkillBox.instance.expList.Count - Skillspend.spendNumber)>=0) if (Skillspend.levelNumber <Skillspend.Maxlevel && (SkillBox.instance.expList.Count - Skillspend.spendNumber)>=0)
{ {
SkillBox.instance.UpdataExp(-Skillspend.spendNumber); SkillBox.instance.UpdataExp(-Skillspend.spendNumber);
Debug.Log(LevelText.text);
Skillspend.levelNumber++; Skillspend.levelNumber++;
/*UpgradeBtn.GetComponent<Image>().sprite = minLevelimg;
UpgradeBtn.transform.Find("UpgradText").GetComponent<Text>().text = "Éý¼¶";
UpgradeBtn.enabled = true;*/
SwitchLevel(Skillspend.levelNumber); SwitchLevel(Skillspend.levelNumber);
Debug.Log(Skillspend.levelNumber);
//因为一开始是没有技能所以先Skillspend.levelNumber++;
Skillspend.mengyao.GetComponent<SkillUp>().UseSkill(Skillspend.index, Skillspend.levelNumber);
} }
else else
{ {
Debug.Log("Õ½»ê²»×ã"); Debug.Log("Õ½»ê²»×ã");
} }
/*if(Skillspend.levelNumber >= Skillspend.Maxlevel)
{
Skillspend.levelNumber = Skillspend.Maxlevel;
UpgradeBtn.GetComponent<Image>().sprite = maxlevelimg;
UpgradeBtn.transform.Find("UpgradText").GetComponent<Text>().text = "µÈ¼¶ÒÑÂú";
SwitchLevel(Skillspend.levelNumber);
return;
}*/
} }
void BtnUpdata() void BtnUpdata()
@ -69,12 +58,10 @@ public class infobox_skill_up : MonoBehaviour
UpgradeBtn.transform.Find("UpgradText").GetComponent<Text>().text = "Éý¼¶"; UpgradeBtn.transform.Find("UpgradText").GetComponent<Text>().text = "Éý¼¶";
UpgradeBtn.enabled = true; UpgradeBtn.enabled = true;
} }
} }
public void SwitchLevel(int level) public void SwitchLevel(int level)
{ {
switch (level) switch (level)
{ {