本文整理汇总了C#中Field.AddPlayerCharacter方法的典型用法代码示例。如果您正苦于以下问题:C# Field.AddPlayerCharacter方法的具体用法?C# Field.AddPlayerCharacter怎么用?C# Field.AddPlayerCharacter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field.AddPlayerCharacter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MenuInGame
public MenuInGame(FSM parentFsm, UIManager2 panel1, UIManager2 panel2)
: base(parentFsm, panel1, panel2, "MenuInGame.fsm")
{
timeClient = TimeManager.Instance.Create();
InitUI();
int stageId = (int)parentFsm.Variables["stageId"];
InitStage(stageId, out stageEntity, out gameEntity);
Rect fieldArea = UI.GetFieldArea();
itemDropManager = new ItemDropManager(stageEntity.GameModeType, stageEntity.ConsumableTier);
field = CreateField(stageEntity, fieldArea, timeClient, itemDropManager, fsm);
// ddong
CharacterSelect characterSelect = new CharacterSelect()
{
heroLevel = SaveData.level,
heroId = GetClassCode(SaveData.selectClass),
equipIds = ArrayTool.Create<int>(),
};
this.heroEntity = TableLoader.GetTable<ItemHeroEntity>().Get(characterSelect.heroId);
Rect puzzleArea = UI.GetPuzzleArea();
CreatePuzzle(stageEntity, heroEntity.HeroType, puzzleArea, timeClient, out puzzleRecord, out puzzlePanel);
user = CreateUser(stageEntity, UI, fsm);
heroCharacter = CreateCharacter(characterSelect, user, puzzlePanel, itemDropManager, UI.AddBuffIcon, UI.RemoveBuffIcon);
user.SetCharacter(heroCharacter);
puzzlePanel.SetOwner(heroCharacter);
Func<float> getLifeDrainRate = (() => gameEntity.DefaultLifeDrainRate + gameEntity.LifeDrainRateIncrease * timeClient.time);
new PlayerCharacter(user, heroCharacter, getLifeDrainRate, fsm);
heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, OnCharacterHPChanged);
heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, UI.ChangeHP);
heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.MP, UI.ChangeMana);
heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.Armor, UI.ChangeShield);
UI.InitCommendSlots(fsm, heroCharacter);
field.AddPlayerCharacter(heroCharacter);
field.FocusOnForced(heroCharacter, 0);
puzzlePanel.SetQueue(user.commandQueue);
SetFocusTarget(heroCharacter);
// ddong
CutInStarter = StartCutIn;
}
示例2: MenuInGame
public MenuInGame(FSM parentFsm, UIManager2 panel1, UIManager2 panel2)
: base(parentFsm, panel1, panel2, "MenuInGame.fsm")
{
timeClient = TimeManager.Instance.Create();
InitUI();
int stageId = (int)parentFsm.Variables["stageId"];
/*
// ddong
if (stageId < 2000)
{
stageId += 2000;
}
*/
InitStage(stageId, out stageEntity, out gameEntity);
Rect fieldArea = UI.GetFieldArea();
field = CreateField(stageEntity, fieldArea, timeClient, fsm);
// ddong
int subClassCode = 11;
int level = 1;
int trainLevel = 1;
this.subClassEntity = TableLoader.GetTable<SubClassEntity>().Get(subClassCode);
ClassLevelEntity levelEntity = TableLoader.GetTable<ClassLevelEntity>().Get(subClassEntity.classCode, level);
TrainLevelEntity trainLevelEntity = TableLoader.GetTable<TrainLevelEntity>().Get(subClassEntity.classCode, trainLevel);
FieldObjectEntity objectField = TableLoader.GetTable<FieldObjectEntity>().Get(subClassEntity.objectCode);
Rect puzzleArea = UI.GetPuzzleArea();
CreatePuzzle(puzzleArea, timeClient, subClassCode, out puzzleRecord, out puzzlePanel);
user = CreateUser(stageEntity, UI, fsm);
heroCharacter = CreateCharacter(objectField, levelEntity, trainLevelEntity, subClassEntity, user, puzzlePanel, itemDropManager, UI.AddBuffIcon, UI.RemoveBuffIcon, fsm);
itemDropManager = new ConsumableSpawn(stageEntity.gameModeCode, levelEntity.consumableTier);
Func<float> getLifeDrainRate = (() => gameEntity.defaultHP);
new PlayerCharacter(user, heroCharacter, getLifeDrainRate, fsm);
/*
heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, OnCharacterHPChanged);
heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, UI.ChangeHP);
heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.MP, UI.ChangeMana);
heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.Armor, UI.ChangeShield);
*/
UI.InitCommendSlots(fsm, heroCharacter);
field.AddPlayerCharacter(heroCharacter);
field.FocusOnForced(heroCharacter, 0);
puzzlePanel.SetQueue(user.commandQueue);
var screenPosTable = TableLoader.GetTable<ScreenPositionEntity2>();
var hpToPos = screenPosTable.Values.Select(x => new KeyValuePair<float, float>(x.hp, x.screenPos));
convertHPRatioToScreenPos = new RangeConvertor(hpToPos).Convert;
SetFocusTarget(heroCharacter);
}