public HeroCharacter(FieldObjectEntity objectField, SubClassEntity subClassEntity, ClassLevelEntity levelEntity, TrainLevelEntity trainLevelEntity, bool toLeft, InGameUser user, PuzzlePanel puzzlePanel, Buff.Handle onBuff, Buff.Handle onDeBuff, FSM parentFsm) : base(objectField, toLeft, parentFsm) { this.subClassEntity = subClassEntity; this.user = user; this.puzzlePanel = puzzlePanel; this.stat = new Stat2<HeroStatType>(StatGenerator.ExportData<HeroStatType>(levelEntity, trainLevelEntity)); this.status = InitStatus(this, stat, subClassEntity); Register(stat); Register(status); /* RegisterDeathCondition(x => x.Get(HeroStatusType.hp) == 0); RegisterBuffHandler(onBuff, onDeBuff); RegistActions(); SkillCommand skillCommand = InitSkill(this, skillId, itemHeroLevel.Level); AddCommandSet("skill", 1, false, E_CommandConsume.Skill, null).TryAdd(skillCommand); * */ }
static HeroCharacter CreateCharacter(FieldObjectEntity objectField, ClassLevelEntity levelEntity, TrainLevelEntity trainLevelEntity, SubClassEntity subClassEntity, InGameUser user, PuzzlePanel puzzlePanel, ConsumableSpawn itemDropManager, System.Action<StatusEffectEntity2> addBuffIcon, System.Action<StatusEffectEntity2> removeBuffIcon, FSM parentFsm) { Buff.Handle onBuff = delegate(Buff buff) { if (addBuffIcon != null) { addBuffIcon(buff.statusEffectEntity); } }; Buff.Handle onDeBuff = delegate(Buff buff) { if (removeBuffIcon != null) { removeBuffIcon(buff.statusEffectEntity); } }; HeroCharacter heroCharacter = new HeroCharacter(objectField, subClassEntity, levelEntity, trainLevelEntity, false, user, puzzlePanel, onBuff, onDeBuff, parentFsm); { Action action = ActionPattern.Create("Vector(Self; [HeroStatType.moveSpeed]; 0; 0; false)").Generate(heroCharacter.Stat); heroCharacter.Fire(action, null); heroCharacter.PauseMoving(); } for (int i = 0; i < 4; i++) { heroCharacter.AddItemSlot(i, user.commandQueue); } { heroCharacter.AddAction(Action.E_Type.Money, delegate(float value, GameInstance firer, string[] param) { Action action = ActionPattern.Create("Action(User; Money; {0})").Generate(heroCharacter.Stat, value); if (action != null) { heroCharacter.Fire(action, null); } return null; } ); heroCharacter.AddAction(Action.E_Type.Exp, delegate(float value, GameInstance firer, string[] param) { Action action = ActionPattern.Create("Action(User; Exp; {0})").Generate(heroCharacter.Stat, value); if (action != null) { heroCharacter.Fire(action, null); } return null; } ); heroCharacter.AddAction(Action.E_Type.GetConsumable, delegate(float value, GameInstance firer, string[] param) { if (RandomTool.IsIn(value)) { var itemCommand = new ItemCommand(itemDropManager.Pick()); if (itemCommand != null) { heroCharacter.TryAddItem(itemCommand); } } return null; } ); } return heroCharacter; }