From e6792484aff13725f73668ea4fb8f5d37d4a4199 Mon Sep 17 00:00:00 2001 From: Jackie Liu Date: Sat, 26 Nov 2022 18:32:08 -0800 Subject: [PATCH] Code refactoring --- Assets/Scripts/Core/DataReader/Scn/ScnFile.cs | 12 +- .../Pal3/Actor/ActorActionController.cs | 2 +- .../Scripts/Pal3/MetaData/ActorConstants.cs | 276 +++++++++--------- .../Common/StandingPlatformController.cs | 4 +- 4 files changed, 147 insertions(+), 147 deletions(-) diff --git a/Assets/Scripts/Core/DataReader/Scn/ScnFile.cs b/Assets/Scripts/Core/DataReader/Scn/ScnFile.cs index 7a3bac97..45ae9236 100644 --- a/Assets/Scripts/Core/DataReader/Scn/ScnFile.cs +++ b/Assets/Scripts/Core/DataReader/Scn/ScnFile.cs @@ -53,18 +53,18 @@ namespace Core.DataReader.Scn AutoTrigger = 0, // 自动触发点 Shakeable = 1, // 碰到后摇晃的物品 Collidable = 2, // 碰到后翻倒的物品 - Arrow = 3, // 飞箭类 (JG06霹雳堂总舵飞剑) + Arrow = 3, // 飞箭类 (霹雳堂总舵飞剑) FallableWeapon = 4, // 落下的伤害物体 (冰棱) MovableCarrier = 5, // 移动浮板 (固定速度和路线往复移动,可载人) Trap = 6, // 陷阱 (调用脚本切换场景) RotatingStoneBeam = 7, // 旋传石梁 (一字型) - RotatingWall = 8, // 旋转墙 (折尺型,JG13) + RotatingWall = 8, // 旋转墙 (折尺型) PreciseTrigger = 9, // 精确触发点 WindBlower = 10, // 风口 Pushable = 11, // 推箱子 SpecialMechanism = 12, // 主角特技机关 - ImpulsiveMechanism = 13, // 冲撞 - Door = 14, // 门,场景切换点 + ImpulsiveMechanism = 13, // 冲撞类机关 + Door = 14, // 门,场景切换点 Climbable = 15, // 藤蔓或梯子 (可爬物) InvestigationTriggerObject = 16, // 调查触发物体 StaticOrAnimated = 17, // 死物体或者随机动画播放(通用参数[0]:对应的地面是否可通过) @@ -83,12 +83,12 @@ namespace Core.DataReader.Scn RareChest = 26, // 迷宫大宝箱 WishPool = 27, // 许愿池 ColdWeapon = 28, // (M24)剑或锤 - GravityTrigger = 29, // 重力机关 + GravityTrigger = 29, // 重力机关(乌龟) ElevatorSwitch = 30, // 升降机关门 WaterSurfaceMechanism = 31, // 水面机关 PiranhaFlower = 32, // 食人花 PedalSwitch = 33, // 踏板开关 - SwordBridge = 34, // (m24)剑桥(触发后向前伸) + SwordBridge = 34, // (m24)剑桥(触发后向前伸) SlideWay = 35, // 滑道 FallableObstacle = 36, // 坠落的障碍物 DivineTreeFlower = 37, // (神树)花 diff --git a/Assets/Scripts/Pal3/Actor/ActorActionController.cs b/Assets/Scripts/Pal3/Actor/ActorActionController.cs index a0f12b45..c7a021fd 100644 --- a/Assets/Scripts/Pal3/Actor/ActorActionController.cs +++ b/Assets/Scripts/Pal3/Actor/ActorActionController.cs @@ -220,7 +220,7 @@ namespace Pal3.Actor private void SetupShadow(ActorActionType actorAction) { - // Disable shadow for HuaYing and TaoZi + // Disable shadow for some of the actors. #if PAL3 if (_actor.Info.Id == (byte) PlayerActorId.HuaYing) return; #elif PAL3A diff --git a/Assets/Scripts/Pal3/MetaData/ActorConstants.cs b/Assets/Scripts/Pal3/MetaData/ActorConstants.cs index c073ed15..3562ffdb 100644 --- a/Assets/Scripts/Pal3/MetaData/ActorConstants.cs +++ b/Assets/Scripts/Pal3/MetaData/ActorConstants.cs @@ -211,28 +211,28 @@ namespace Pal3.MetaData #if PAL3 public static readonly Dictionary MainActorNameMap = new() { - {PlayerActorId.JingTian, "101"}, - {PlayerActorId.XueJian, "104"}, - {PlayerActorId.LongKui, "105"}, // 105 人形 106 鬼形 - {PlayerActorId.ZiXuan, "107"}, - {PlayerActorId.ChangQing, "102"}, - {PlayerActorId.HuaYing, "109"} + { PlayerActorId.JingTian, "101" }, + { PlayerActorId.XueJian, "104" }, + { PlayerActorId.LongKui, "105" }, // 105 人形 106 鬼形 + { PlayerActorId.ZiXuan, "107" }, + { PlayerActorId.ChangQing, "102" }, + { PlayerActorId.HuaYing, "109" } }; #elif PAL3A public static readonly Dictionary MainActorNameMap = new() { - {PlayerActorId.NanGongHuang, "101"}, // 101 人形 107 狼形 - {PlayerActorId.WenHui, "102"}, - {PlayerActorId.WangPengXu, "103"}, - {PlayerActorId.XingXuan, "104"}, - {PlayerActorId.LeiYuanGe, "105"}, - {PlayerActorId.TaoZi, "106"}, // 桃子兽形 + { PlayerActorId.NanGongHuang, "101" }, // 101 人形 107 狼形 + { PlayerActorId.WenHui, "102" }, + { PlayerActorId.WangPengXu, "103" }, + { PlayerActorId.XingXuan, "104" }, + { PlayerActorId.LeiYuanGe, "105" }, + { PlayerActorId.TaoZi, "106" }, // 桃子兽形 }; public static readonly Dictionary FengYaSongActorNameMap = new() { - {FengYaSongActorId.Feng, "110"}, // 风 - {FengYaSongActorId.Ya, "108"}, // 雅 - {FengYaSongActorId.Song, "109"}, // 颂 + { FengYaSongActorId.Feng, "110" }, // 风 + { FengYaSongActorId.Ya, "108" }, // 雅 + { FengYaSongActorId.Song, "109" }, // 颂 }; #endif @@ -260,148 +260,148 @@ namespace Pal3.MetaData public static readonly Dictionary ActionNames = new() { // 基本动作 - { ActorActionType.Stand, "c01"}, // 站立 - { ActorActionType.Walk, "c02"}, // 行走 - { ActorActionType.Run, "c03"}, // 奔跑 - { ActorActionType.Back, "c15"}, // 后退 - { ActorActionType.Jump, "c04"}, // 起跳 - { ActorActionType.Climb, "c05"}, // 攀爬 - { ActorActionType.ClimbDown, "c052"}, // 向下攀爬 - { ActorActionType.Push, "c06"}, // 推 - { ActorActionType.Skill, "c07"}, // 技能 - { ActorActionType.Tire, "c08"}, // 疲倦 - { ActorActionType.Seat, "c09"}, // 坐 - { ActorActionType.Check, "c10"}, // 调查 - { ActorActionType.Sleep, "c11"}, // 睡觉 - { ActorActionType.Shake, "c12"}, // 摇头 - { ActorActionType.Nod, "c13"}, // 点头 - { ActorActionType.Wave, "c14"}, // 摆手 + { ActorActionType.Stand, "c01" }, // 站立 + { ActorActionType.Walk, "c02" }, // 行走 + { ActorActionType.Run, "c03" }, // 奔跑 + { ActorActionType.Back, "c15" }, // 后退 + { ActorActionType.Jump, "c04" }, // 起跳 + { ActorActionType.Climb, "c05" }, // 攀爬 + { ActorActionType.ClimbDown, "c052" }, // 向下攀爬 + { ActorActionType.Push, "c06" }, // 推 + { ActorActionType.Skill, "c07" }, // 技能 + { ActorActionType.Tire, "c08" }, // 疲倦 + { ActorActionType.Seat, "c09" }, // 坐 + { ActorActionType.Check, "c10" }, // 调查 + { ActorActionType.Sleep, "c11" }, // 睡觉 + { ActorActionType.Shake, "c12" }, // 摇头 + { ActorActionType.Nod, "c13" }, // 点头 + { ActorActionType.Wave, "c14" }, // 摆手 // 剧情动作 - { ActorActionType.Signature, "j01"}, // 招牌 - { ActorActionType.Shocked, "j02"}, // 惊吓 - { ActorActionType.SeatDown, "j03"}, // 下蹲 - { ActorActionType.SeatUp, "j04"}, // 坐起 - { ActorActionType.Point, "j05"}, // 指点 - { ActorActionType.Kick, "j06"}, // 踢 - { ActorActionType.Salute, "j07"}, // 行礼 - { ActorActionType.Tease, "j08"}, // 挑逗 - { ActorActionType.Snuggle, "j09"}, // 依偎 - { ActorActionType.Whining, "j10"}, // 撒娇 - { ActorActionType.Anger, "j11"}, // 发怒 - { ActorActionType.Dose, "j12"}, // 服药 - { ActorActionType.J13, "j13"}, // 得意 + { ActorActionType.Signature, "j01" }, // 招牌 + { ActorActionType.Shocked, "j02" }, // 惊吓 + { ActorActionType.SeatDown, "j03" }, // 下蹲 + { ActorActionType.SeatUp, "j04" }, // 坐起 + { ActorActionType.Point, "j05" }, // 指点 + { ActorActionType.Kick, "j06" }, // 踢 + { ActorActionType.Salute, "j07" }, // 行礼 + { ActorActionType.Tease, "j08" }, // 挑逗 + { ActorActionType.Snuggle, "j09" }, // 依偎 + { ActorActionType.Whining, "j10" }, // 撒娇 + { ActorActionType.Anger, "j11" }, // 发怒 + { ActorActionType.Dose, "j12" }, // 服药 + { ActorActionType.J13, "j13" }, // 得意 // 战斗动作 - { ActorActionType.Attack1, "z01"}, // 攻击1 - { ActorActionType.Attack2, "z02"}, // 攻击2 - { ActorActionType.AttackMove, "z03"}, // 攻击移动 - { ActorActionType.PreAttack, "z04"}, // 备战 - { ActorActionType.BeAttack, "z05"}, // 被攻击 - { ActorActionType.MagicWait, "z061"}, // 仙术预备 - { ActorActionType.Magic, "z06"}, // 仙术 - { ActorActionType.Skill1, "z09"}, // 特技1 - { ActorActionType.Skill2, "z10"}, // 特技2 - { ActorActionType.UseItemRecover, "z11"}, // 恢复物品 - { ActorActionType.UseItemAttack, "z12"}, // 攻击物品 - { ActorActionType.WeaponSkill, "z13"}, // 武器技 - { ActorActionType.StartDefence, "z14"}, // 开始防御 - { ActorActionType.Defence, "z141"}, // 防御 - { ActorActionType.DefenceBeAttack, "z142"}, // 攻击被防住 - { ActorActionType.Dodge, "z15"}, // 回避 - { ActorActionType.Freeze, "z16"}, // 眠定 - { ActorActionType.Dying, "z17"}, // 濒死 - { ActorActionType.Dead, "z18"}, // 死亡 - { ActorActionType.Flee, "z19"}, // 逃跑等到 - { ActorActionType.Win, "z20"}, // 胜利 + { ActorActionType.Attack1, "z01" }, // 攻击1 + { ActorActionType.Attack2, "z02" }, // 攻击2 + { ActorActionType.AttackMove, "z03" }, // 攻击移动 + { ActorActionType.PreAttack, "z04" }, // 备战 + { ActorActionType.BeAttack, "z05" }, // 被攻击 + { ActorActionType.MagicWait, "z061" }, // 仙术预备 + { ActorActionType.Magic, "z06" }, // 仙术 + { ActorActionType.Skill1, "z09" }, // 特技1 + { ActorActionType.Skill2, "z10" }, // 特技2 + { ActorActionType.UseItemRecover, "z11" }, // 恢复物品 + { ActorActionType.UseItemAttack, "z12" }, // 攻击物品 + { ActorActionType.WeaponSkill, "z13" }, // 武器技 + { ActorActionType.StartDefence, "z14" }, // 开始防御 + { ActorActionType.Defence, "z141" }, // 防御 + { ActorActionType.DefenceBeAttack, "z142" }, // 攻击被防住 + { ActorActionType.Dodge, "z15" }, // 回避 + { ActorActionType.Freeze, "z16" }, // 眠定 + { ActorActionType.Dying, "z17" }, // 濒死 + { ActorActionType.Dead, "z18" }, // 死亡 + { ActorActionType.Flee, "z19" }, // 逃跑等到 + { ActorActionType.Win, "z20" }, // 胜利 // NPC,怪物动作 - { ActorActionType.NpcStand1, "z1"}, // 站立1 - { ActorActionType.NpcStand2, "z2"}, // 站立2 - { ActorActionType.NpcWalk, "z3"}, // 行走 - { ActorActionType.NpcAttack, "g"}, // 攻击 - { ActorActionType.NpcBeAttacked, "b"}, // 攻击 - { ActorActionType.NpcMagic1, "x1"}, // 仙术1 - { ActorActionType.NpcMagic2, "x2"}, // 仙术2 - { ActorActionType.NpcMagic3, "x3"}, // 仙术3 - { ActorActionType.NpcRun, "z3"}, // 跑,用走代替 + { ActorActionType.NpcStand1, "z1" }, // 站立1 + { ActorActionType.NpcStand2, "z2" }, // 站立2 + { ActorActionType.NpcWalk, "z3" }, // 行走 + { ActorActionType.NpcAttack, "g" }, // 攻击 + { ActorActionType.NpcBeAttacked, "b" }, // 攻击 + { ActorActionType.NpcMagic1, "x1" }, // 仙术1 + { ActorActionType.NpcMagic2, "x2" }, // 仙术2 + { ActorActionType.NpcMagic3, "x3" }, // 仙术3 + { ActorActionType.NpcRun, "z3" }, // 跑,用走代替 }; #elif PAL3A public static readonly Dictionary ActionNames = new() { // 基本动作 - { ActorActionType.Stand, "c01"}, // 站立 - { ActorActionType.Walk, "c02"}, // 行走 - { ActorActionType.Run, "c03"}, // 奔跑 - { ActorActionType.Back, "c15"}, // 后退 - { ActorActionType.Jump, "c05"}, // 起跳 - { ActorActionType.Climb, "c04a"}, // 向上攀爬 - { ActorActionType.ClimbDown, "c04b"}, // 向下攀爬 - { ActorActionType.Push, "c013"}, // 推 - { ActorActionType.Skill, "c06"}, // 技能 - { ActorActionType.Tire, "c07"}, // 疲倦 - { ActorActionType.Seat, "c12"}, // 坐 - { ActorActionType.Check, "c08"}, // 调查 - { ActorActionType.Sleep, "j04"}, // 睡觉 - { ActorActionType.Shake, "c09"}, // 摇头 - { ActorActionType.Nod, "c10"}, // 点头 - { ActorActionType.Wave, "c11"}, // 摆手 + { ActorActionType.Stand, "c01" }, // 站立 + { ActorActionType.Walk, "c02" }, // 行走 + { ActorActionType.Run, "c03" }, // 奔跑 + { ActorActionType.Back, "c15" }, // 后退 + { ActorActionType.Jump, "c05" }, // 起跳 + { ActorActionType.Climb, "c04a" }, // 向上攀爬 + { ActorActionType.ClimbDown, "c04b" }, // 向下攀爬 + { ActorActionType.Push, "c013" }, // 推 + { ActorActionType.Skill, "c06" }, // 技能 + { ActorActionType.Tire, "c07" }, // 疲倦 + { ActorActionType.Seat, "c12" }, // 坐 + { ActorActionType.Check, "c08" }, // 调查 + { ActorActionType.Sleep, "j04" }, // 睡觉 + { ActorActionType.Shake, "c09" }, // 摇头 + { ActorActionType.Nod, "c10" }, // 点头 + { ActorActionType.Wave, "c11" }, // 摆手 // 剧情动作 - { ActorActionType.Threaten, "j15"}, // 威胁 - { ActorActionType.Shocked, "j06"}, // 惊吓 - { ActorActionType.BendOver, "j07"}, // 下蹲 - { ActorActionType.SeatUp, "j02"}, // 坐起 - { ActorActionType.Point, "j05"}, // 指点 - { ActorActionType.Kick, "j06"}, // 踢 - { ActorActionType.Salute, "j09"}, // 行礼 - { ActorActionType.Tease, "j08"}, // 挑逗 - { ActorActionType.Snuggle, "j09"}, // 依偎 - { ActorActionType.Whining, "j10"}, // 撒娇 - { ActorActionType.Anger, "j11"}, // 发怒 - { ActorActionType.Dose, "j03"}, // 服药 - { ActorActionType.J13, "j12"}, // 得意 + { ActorActionType.Threaten, "j15" }, // 威胁 + { ActorActionType.Shocked, "j06" }, // 惊吓 + { ActorActionType.BendOver, "j07" }, // 下蹲 + { ActorActionType.SeatUp, "j02" }, // 坐起 + { ActorActionType.Point, "j05" }, // 指点 + { ActorActionType.Kick, "j06" }, // 踢 + { ActorActionType.Salute, "j09" }, // 行礼 + { ActorActionType.Tease, "j08" }, // 挑逗 + { ActorActionType.Snuggle, "j09" }, // 依偎 + { ActorActionType.Whining, "j10" }, // 撒娇 + { ActorActionType.Anger, "j11" }, // 发怒 + { ActorActionType.Dose, "j03" }, // 服药 + { ActorActionType.J13, "j12" }, // 得意 // 战斗动作 - { ActorActionType.Attack1, "z01"}, // 攻击1 - { ActorActionType.Attack2, "z02"}, // 攻击2 - { ActorActionType.AttackMove, "z04"}, // 攻击移动 - { ActorActionType.PreAttack, "z03"}, // 备战 - { ActorActionType.BeAttack, "z05"}, // 被攻击 - { ActorActionType.MagicWait, "z081"}, // 仙术预备 - { ActorActionType.Magic, "z08"}, // 仙术 - { ActorActionType.Skill1, "z17"}, // 特技1 - { ActorActionType.Skill2, "z18"}, // 特技2 - { ActorActionType.UseItemRecover, "z09"}, // 恢复物品 - { ActorActionType.UseItemAttack, "z10"}, // 攻击物品 - { ActorActionType.WeaponSkill, "z19"}, // 武器技 - { ActorActionType.StartDefence, "z061"}, // 开始防御 - { ActorActionType.Defence, "z062"}, // 防御 - { ActorActionType.DefenceBeAttack, "z063"}, // 攻击被防住 - { ActorActionType.Dodge, "z07"}, // 回避 - { ActorActionType.Freeze, "z11"}, // 眠定 - { ActorActionType.Dying, "z12"}, // 濒死 - { ActorActionType.Dead, "z13"}, // 死亡 - { ActorActionType.Flee, "z14"}, // 逃跑等到 - { ActorActionType.Win, "z15"}, // 胜利 + { ActorActionType.Attack1, "z01" }, // 攻击1 + { ActorActionType.Attack2, "z02" }, // 攻击2 + { ActorActionType.AttackMove, "z04" }, // 攻击移动 + { ActorActionType.PreAttack, "z03" }, // 备战 + { ActorActionType.BeAttack, "z05" }, // 被攻击 + { ActorActionType.MagicWait, "z081" }, // 仙术预备 + { ActorActionType.Magic, "z08" }, // 仙术 + { ActorActionType.Skill1, "z17" }, // 特技1 + { ActorActionType.Skill2, "z18" }, // 特技2 + { ActorActionType.UseItemRecover, "z09" }, // 恢复物品 + { ActorActionType.UseItemAttack, "z10" }, // 攻击物品 + { ActorActionType.WeaponSkill, "z19" }, // 武器技 + { ActorActionType.StartDefence, "z061" }, // 开始防御 + { ActorActionType.Defence, "z062" }, // 防御 + { ActorActionType.DefenceBeAttack, "z063" }, // 攻击被防住 + { ActorActionType.Dodge, "z07" }, // 回避 + { ActorActionType.Freeze, "z11" }, // 眠定 + { ActorActionType.Dying, "z12" }, // 濒死 + { ActorActionType.Dead, "z13" }, // 死亡 + { ActorActionType.Flee, "z14" }, // 逃跑等到 + { ActorActionType.Win, "z15" }, // 胜利 // NPC,怪物动作 - { ActorActionType.NpcStand1, "z1"}, // 站立1 - { ActorActionType.NpcStand2, "z2"}, // 站立2 - { ActorActionType.NpcWalk, "z3"}, // 行走 - { ActorActionType.NpcAttack, "g"}, // 攻击 - { ActorActionType.NpcBeAttacked, "b"}, // 攻击 - { ActorActionType.NpcMagic1, "x1"}, // 仙术1 - { ActorActionType.NpcMagic2, "x2"}, // 仙术2 - { ActorActionType.NpcMagic3, "x3"}, // 仙术3 - { ActorActionType.NpcRun, "z3"}, // 跑,用走代替 + { ActorActionType.NpcStand1, "z1" }, // 站立1 + { ActorActionType.NpcStand2, "z2" }, // 站立2 + { ActorActionType.NpcWalk, "z3" }, // 行走 + { ActorActionType.NpcAttack, "g" }, // 攻击 + { ActorActionType.NpcBeAttacked, "b" }, // 攻击 + { ActorActionType.NpcMagic1, "x1" }, // 仙术1 + { ActorActionType.NpcMagic2, "x2" }, // 仙术2 + { ActorActionType.NpcMagic3, "x3" }, // 仙术3 + { ActorActionType.NpcRun, "z3" }, // 跑,用走代替 // 仙剑三外传新增动作 - { ActorActionType.LevelUp, "z16"}, // 升级 - { ActorActionType.Transform, "z20"}, // 变身 - { ActorActionType.Attack21, "z021"}, // 扔八卦的第一段动作 - { ActorActionType.Attack22, "z022"}, // 扔八卦的第二段动作 - { ActorActionType.Attack23, "z023"}, // 扔八卦的第三段动作 + { ActorActionType.LevelUp, "z16" }, // 升级 + { ActorActionType.Transform, "z20" }, // 变身 + { ActorActionType.Attack21, "z021" }, // 扔八卦的第一段动作 + { ActorActionType.Attack22, "z022" }, // 扔八卦的第二段动作 + { ActorActionType.Attack23, "z023" }, // 扔八卦的第三段动作 }; #endif diff --git a/Assets/Scripts/Pal3/Scene/SceneObjects/Common/StandingPlatformController.cs b/Assets/Scripts/Pal3/Scene/SceneObjects/Common/StandingPlatformController.cs index a89cb997..4e5fbcaa 100644 --- a/Assets/Scripts/Pal3/Scene/SceneObjects/Common/StandingPlatformController.cs +++ b/Assets/Scripts/Pal3/Scene/SceneObjects/Common/StandingPlatformController.cs @@ -6,7 +6,6 @@ namespace Pal3.Scene.SceneObjects.Common { using System; - using Core.Extensions; using UnityEngine; public class StandingPlatformController : MonoBehaviour @@ -40,7 +39,8 @@ namespace Pal3.Scene.SceneObjects.Common public float GetPlatformHeight() { - // A little bit lower than the platform to make sure the bounds check pass when (X,Z) is inside the platform + // A little bit lower than the collider bounds just to make sure + // the actor is always inside the collider when standing on the platform. return _collider.bounds.max.y - 0.05f; }