本文主要是介绍骑砍2霸主MOD开发(14)-进击的巨人,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一.巨人
sbyte boneIndex = Skeleton.GetBoneIndexFromName(Mission.MainAgent.AgentVisuals.GetSkeleton().GetName(), "r_hand");
cp = Mission.MainAgent.AgentVisuals.AddPrefabToAgentVisualBoneByRealBoneIndex("p_sword_a", boneIndex);
float agentScale = Mission.MainAgent.AgentScale;
agentScale += 9f;
MethodInfo method = AccessTools.Method(typeof(Agent), "SetInitialAgentScale");
method.Invoke(Mission.MainAgent, new object[1] { agentScale });
二.巨人践踏
public class HugeManTimer_1 : PLCommonBasicMissionTimer{private Mission _mission;public HugeManTimer_1(Mission mission, float triggerInterval, bool isTriggerOnce) : base(triggerInterval, isTriggerOnce){_mission = mission;}public override void TriggerTimerScript(){try{MainAgentSpeedUp();MainAgentSwordAttack();}catch (Exception ex){File.AppendAllLines(PLModuleConstans.ModuleCrashLogPath, new string[] { ex.ToString(), ex.Message, ex.StackTrace });}}private void MainAgentSpeedUp(){if (Input.IsKeyDown(InputKey.W)){PLAgentUtilities.AgentMoveAlongAxix(_mission.MainAgent, 0.3f, PLAgentUtilities.Axix.Y);}if (Input.IsKeyDown(InputKey.S)){PLAgentUtilities.AgentMoveAlongAxix(_mission.MainAgent, -0.3f, PLAgentUtilities.Axix.Y);}if (Input.IsKeyDown(InputKey.A)){PLAgentUtilities.AgentMoveAlongAxix(_mission.MainAgent, -0.3f, PLAgentUtilities.Axix.X);}if (Input.IsKeyDown(InputKey.D)){PLAgentUtilities.AgentMoveAlongAxix(_mission.MainAgent, 0.3f, PLAgentUtilities.Axix.X);}}private void MainAgentSwordAttack(){if (MissionAgentBehavior.cp == null){return;}if (Input.IsKeyPressed(InputKey.LeftMouseButton)){MBList<Agent> enemyAgentList = new MBList<Agent>();_mission.GetNearbyEnemyAgents(new Vec2(_mission.MainAgent.Frame.origin.x, _mission.MainAgent.Frame.origin.y), 5f, _mission.MainAgent.Team, enemyAgentList);foreach (Agent enemyAgent in enemyAgentList){PLAgentUtilities.GiveDamageToAgent(_mission.MainAgent, enemyAgent, 60);}}if (Input.IsKeyPressed(InputKey.Space)){MBList<Agent> enemyAgentList = new MBList<Agent>();_mission.GetNearbyEnemyAgents(new Vec2(_mission.MainAgent.Frame.origin.x, _mission.MainAgent.Frame.origin.y),5f, _mission.MainAgent.Team, enemyAgentList);foreach (Agent enemyAgent in enemyAgentList){PLAgentUtilities.GiveDamageToAgent(_mission.MainAgent, enemyAgent, 100);}}}}
这篇关于骑砍2霸主MOD开发(14)-进击的巨人的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!