Browse Source

fix: 🐛 fix a bug of returning null when using Skill

tags/0.1.0
shangfengh 2 years ago
parent
commit
488b390c08
3 changed files with 13 additions and 9 deletions
  1. +1
    -0
      logic/GameClass/GameObj/Character/Character.Skill.cs
  2. +4
    -0
      logic/GameClass/GameObj/Character/Skill.cs
  3. +8
    -9
      logic/Gaming/SkillManager/SkillManager.ActiveSkill.cs

+ 1
- 0
logic/GameClass/GameObj/Character/Character.Skill.cs View File

@@ -2,6 +2,7 @@
using Preparation.Interface; using Preparation.Interface;
using System.Collections.Generic; using System.Collections.Generic;
using System; using System;
using System.Numerics;


namespace GameClass.GameObj namespace GameClass.GameObj
{ {


+ 4
- 0
logic/GameClass/GameObj/Character/Skill.cs View File

@@ -80,6 +80,10 @@ namespace GameClass.GameObj
return new BecomeInvisible(); return new BecomeInvisible();
case ActiveSkillType.UseKnife: case ActiveSkillType.UseKnife:
return new UseKnife(); return new UseKnife();
case ActiveSkillType.CanBeginToCharge:
return new CanBeginToCharge();
case ActiveSkillType.Punish:
return new Punish();
default: default:
return new NullSkill(); return new NullSkill();
} }


+ 8
- 9
logic/Gaming/SkillManager/SkillManager.ActiveSkill.cs View File

@@ -30,15 +30,12 @@ namespace Gaming


if ((!player.Commandable())) return false; if ((!player.Commandable())) return false;
IActiveSkill skill = player.UseIActiveSkill(ActiveSkillType.CanBeginToCharge); IActiveSkill skill = player.UseIActiveSkill(ActiveSkillType.CanBeginToCharge);
return ActiveSkillEffect(skill, player, () =>
{
player.AddMoveSpeed(skill.DurationTime, 3.0);
//player.BulletOfPlayer = BulletType.Ram;
new Thread
Debugger.Output(player, "can begin to charge!");
new Thread
( (
() => () =>
{ {
new FrameRateTaskExecutor<int>(
new FrameRateTaskExecutor<int>(
loopCondition: () => player.Commandable() && gameMap.Timer.IsGaming, loopCondition: () => player.Commandable() && gameMap.Timer.IsGaming,
loopToDo: () => loopToDo: () =>
{ {
@@ -70,8 +67,11 @@ namespace Gaming
} }


) )
{ IsBackground = true }.Start();
Debugger.Output(player, "can begin to charge!");
{ IsBackground = true }.Start();

return ActiveSkillEffect(skill, player, () =>
{
player.AddMoveSpeed(skill.DurationTime, 3.0);
}, },
() => () =>
{ {
@@ -161,7 +161,6 @@ namespace Gaming
ActiveSkillType activeSkillType = SkillFactory.FindActiveSkillType(activeSkill); ActiveSkillType activeSkillType = SkillFactory.FindActiveSkillType(activeSkill);
if (player.TimeUntilActiveSkillAvailable[activeSkillType] == 0) if (player.TimeUntilActiveSkillAvailable[activeSkillType] == 0)
{ {

player.SetTimeUntilActiveSkillAvailable(activeSkillType, activeSkill.SkillCD); player.SetTimeUntilActiveSkillAvailable(activeSkillType, activeSkill.SkillCD);
new Thread new Thread
(() => (() =>


Loading…
Cancel
Save