Exemplo n.º 1
0
            public AnimateBehavior(IdleController controller, Dictionary <string, string> definitions, string[] animations) : base(controller)
            {
                this.animations = new List <IdleAnimation>();

                foreach (string animation in animations)
                {
                    if (!definitions.TryGetValue(animation, out string definition))
                    {
                        controller.ai.Monitor.Log($"Cannot get animation definition for `{animation}`, NPC `{controller.ai.npc.Name}`", LogLevel.Error);
                        continue;
                    }

                    try
                    {
                        var(intro, loop, outro, _) = definition.Split('/');

                        this.animations.Add(
                            new IdleAnimation
                        {
                            intro = Utility.parseStringToIntArray(intro),
                            loop  = Utility.parseStringToIntArray(loop),
                            outro = Utility.parseStringToIntArray(outro),
                        }
                            );
                    } catch (Exception e)
                    {
                        controller.ai.Monitor.Log($"Intro or loop or outro animation for {animation} not defined or broken! Companion: {controller.ai.npc.Name} Error: {e.Message}", LogLevel.Error);
                    }
                }
            }
Exemplo n.º 2
0
            public AnimateBehavior(IdleController controller, Dictionary <string, string> definitions, string[] animations) : base(controller)
            {
                this.animations = new List <int[]>();

                foreach (string animation in animations)
                {
                    if (!definitions.TryGetValue(animation, out string definition))
                    {
                        throw new Exception($"Cannot get animation definition for `{animation}`, NPC `{controller.ai.npc.Name}`");
                    }

                    var(_, loop, _) = definition.Split('/');
                    this.animations.Add(Utility.parseStringToIntArray(loop));
                }
            }
Exemplo n.º 3
0
 public IdleBehavior(IdleController controller)
 {
     this.controller = controller;
     this.monitor    = this.controller.ai.Monitor;
     this.npc        = controller.ai.npc;
 }
Exemplo n.º 4
0
 public LookAroundBehavior(IdleController controller, int minSeconds, int maxSeconds) : base(controller)
 {
     this.minSeconds = minSeconds;
     this.maxSeconds = maxSeconds;
 }