本文整理汇总了C#中ICharacter.AddComponent方法的典型用法代码示例。如果您正苦于以下问题:C# ICharacter.AddComponent方法的具体用法?C# ICharacter.AddComponent怎么用?C# ICharacter.AddComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICharacter
的用法示例。
在下文中一共展示了ICharacter.AddComponent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadAsync
public async Task<ICharacter> LoadAsync(IGame game)
{
AGSLoadImageConfig loadConfig = new AGSLoadImageConfig(new AGS.API.Point(0, 0));
var footstep = await game.Factory.Sound.LoadAudioClipAsync("../../Assets/Sounds/151238__owlstorm__hard-female-footstep-2.wav");
ISoundEmitter emitter = new AGSSoundEmitter (game);
emitter.AudioClip = footstep;
IOutfit outfit = await game.Factory.Outfit.LoadOutfitFromFoldersAsync(_baseFolder, walkLeftFolder: "Walk/left",
walkDownFolder: "Walk/front", idleLeftFolder: "Idle/left", idleDownFolder: "Idle/front",
speakLeftFolder: "Talk", loadConfig: loadConfig);
_character = game.Factory.Object.GetCharacter("Cris", outfit).Remember(game, c => _character = c);
_character.SpeechConfig.TextConfig = AGSTextConfig.ChangeColor(_character.SpeechConfig.TextConfig, Colors.OrangeRed, Colors.Black, 1f);
_character.AddComponent<IApproachComponent>();
emitter.Object = _character;
//Uncomment for portrait
/*
var portrait = game.Factory.Object.GetObject("CrisPortrait");
portrait.StartAnimation(game.Factory.Graphics.LoadAnimationFromFolder(_baseFolder + "Talk"));
portrait.Border = AGSBorders.SolidColor(Colors.AliceBlue, 3f, true);
portrait.Visible = false;
portrait.RenderLayer = AGSLayers.Speech;
portrait.IgnoreViewport = true;
portrait.IgnoreScalingArea = true;
game.State.UI.Add(portrait);
_character.SpeechConfig.PortraitConfig = new AGSPortraitConfig { Portrait = portrait, Positioning = PortraitPositioning.Alternating };
*/
var speakAnimation = _character.Outfit[AGSOutfit.Speak];
Characters.RandomAnimationDelay(speakAnimation.Left);
Characters.RandomAnimationDelay(speakAnimation.Right);
emitter.Assign(_character.Outfit[AGSOutfit.Walk], 1, 5);
_character.StartAnimation (_character.Outfit[AGSOutfit.Idle].Down);
_character.Hotspot = "Cris";
_character.PixelPerfect(true);
Characters.Cris = _character;
return _character;
}