Exemplo n.º 1
0
 private static void RegisterBehaviours(IBehaviour behaviour, IMessagingClient client)
 {
     foreach (var handler in behaviour.GetMessageReceivedBehaviours())
     {
         client.RegisterEventHandler(handler.EventType, handler.EventHandler);
     }
 }
Exemplo n.º 2
0
Arquivo: Enemy.cs Projeto: mokujin/DN
        public Enemy(GameWorld gameWorld, IBehaviour behaviour = null)
            : base(gameWorld)
        {
            DestroyEvent += CreateDeadBodyOnDestroyEvent;
            DestroyEvent += CreateLettersOnDestroyEvent;
            CollisionWithObjects += OnCollision;

            _behaviour = behaviour;
        }
Exemplo n.º 3
0
        public Blob(string name, int health, int damage, string behaviour, string attackType)
        {
            this.Name = name;
            this.Health = health;
            this.Damage = damage;
            this.AttackType = Engine.AttackFactory.CreateAttack(attackType, this);
            this.Behaviour = Engine.BehaviourFactory.CreateBehaviour(behaviour, this);
            this.InitialHealth = health;
            this.IsDead = false;

        }
Exemplo n.º 4
0
        public void OnMessage(IMessage message)
        {
            switch (message.MessageType)
            {
                case MessageType.CollisionEnter:
                    {
                        var collisionEnterMessage = message as CollisionEnterMessage;
                        if (collisionEnterMessage == null) return;
                        GameObject other = collisionEnterMessage.CollidingObject;
                        behaviourStats = GameObject.GetBehaviourOfType("StatBehaviour");
                        if (!other.HasBehaviourOfType("WeaponBehaviour")) return;
                        if (other != OwnSword)
                        {
                            hit(other);
                        }

                    }
                    break;
            }
        }
Exemplo n.º 5
0
 public void AddBehaviour( IBehaviour behaviour )
 {
 }
Exemplo n.º 6
0
 public bool TryGetBehaviour(string abbreviatedName, out IBehaviour behaviour)
 {
     lock (Behaviours)
         return(Behaviours.TryGetValue(abbreviatedName, out behaviour));
 }
Exemplo n.º 7
0
 public MockDecoratorBehaviour(IBehaviour <MockContext> child) : base("MockDecoratorBehaviour", child)
 {
 }
Exemplo n.º 8
0
 private void ApplicationQuit(IBehaviour behaviour)
 {
     behaviour?.OnApplicationQuit();
 }
Exemplo n.º 9
0
 public AttachBehaviourAction(IBehaviour behaviour, ITreeItem target)
 {
     _behaviour = behaviour;
     _treeItem  = target;
 }
Exemplo n.º 10
0
 private void RenderBehaviourTree(Graphics graphics, int depth, IBehaviour <BtContext> behaviour)
 {
     RenderBehaviourTree(graphics, depth, (dynamic)behaviour);
 }
Exemplo n.º 11
0
 public Repeat(IBehaviour <TContext> child, int repeatCount) : this("Repeat", child, repeatCount)
 {
 }
Exemplo n.º 12
0
 /// <summary>
 /// Remove a behaviour from this HaptiQ
 /// </summary>
 /// <param name="behaviour"></param>
 public void removeBehaviour(IBehaviour behaviour)
 {
     lock (_behaviours)
     {
         _behaviours.Remove(behaviour);
     }
 }
Exemplo n.º 13
0
 public Cooldown(IBehaviour <TContext> child, int cooldownTimeInMilliseconds) : this("Cooldown", child, cooldownTimeInMilliseconds)
 {
 }
Exemplo n.º 14
0
 public Robot(string name, IBehaviour behaviour)
 {
     this.Name      = name;
     this.Behaviour = behaviour;
 }
Exemplo n.º 15
0
 public Technology(IBehaviour behaviour)
 {
     _behaviour = behaviour;
 }
Exemplo n.º 16
0
        public bool AddBehaviour(IBehaviour behaviour)
        {
            lock (Behaviours)
            {
                if (!Behaviours.ContainsKey(behaviour.AbbreviatedName))
                {                    
                    behaviour.Initialize(this);
                    Behaviours.Add(behaviour.AbbreviatedName, behaviour);

                    return true;
                }
            }

            return false;
        }
Exemplo n.º 17
0
 /// <summary>
 /// Updates this behaviour based on an another behaviour
 /// </summary>
 /// <param name="behaviour"></param>
 public override void updateNext(IBehaviour behaviour)
 {
     base.updateNext(behaviour);
     NotificationBehaviour notificationBehaviour = behaviour as NotificationBehaviour;
     if (notificationBehaviour != null)
     {
         this._positions = notificationBehaviour._positions;
     }
 }
Exemplo n.º 18
0
 /// <summary>
 ///     Adds a behaviour to the game object.
 /// </summary>
 /// <param name="behaviour">The behaviour to add.</param>
 public void AddBehaviour(string i, IBehaviour behaviour)
 {
     behaviour.GameObject = this;
     behaviours.Add(i, behaviour);
 }
Exemplo n.º 19
0
 public void AttachBehaviour( ITreeItem target, IBehaviour behaviour)
 {
     _memento.Record(@"Attach behavour to '{0}'".FormatWith(target.Name), () =>
         {
             target.Behaviours.Add( behaviour );
             tryFire( ( ) => ItemsAddedOrRemoved, target ) ;
         });
 }
Exemplo n.º 20
0
 public AttachBehaviourAction(IBehaviour behaviour, ITreeItem target )
 {
     _behaviour = behaviour ;
     _treeItem = target ;
 }
Exemplo n.º 21
0
Arquivo: Enemy.cs Projeto: mokujin/DN
 public void SetBehaviour(IBehaviour behaviour)
 {
     _behaviour = behaviour;
     _behaviour.Initialize();
 }
 public static AgentMoc CreateAgent(ActorPaths actorPaths, IActorRef principal, IBehaviour behaviour, GuardianType guardianType)
 {
     return(new AgentMoc(actorPaths: actorPaths,
                         time: 0,
                         debug: false,
                         principal: principal,
                         behaviour: behaviour,
                         guardianType: guardianType));
 }
Exemplo n.º 23
0
 public void Remove(IBehaviour item)
 {
     item.Control = null;
     this.InnerList.Remove(item);
 }
Exemplo n.º 24
0
 public void AddBehaviour( IBehaviour behaviour )
 {
     Behaviours.Add( behaviour );
 }
Exemplo n.º 25
0
 public bool Contains(IBehaviour item)
 {
     return(this.InnerList.Contains(item));
 }
Exemplo n.º 26
0
 public BehaviourController(Enemy enemy, Dray dray)
 {
     this.enemy     = enemy;
     this.dray      = dray;
     this.behaviour = new RandomWalkBehaviour(enemy);
 }
Exemplo n.º 27
0
 public Succeeder(IBehaviour <TContext> child) : this("Succeeder", child)
 {
 }
Exemplo n.º 28
0
 public void AddBehaviour(IBehaviour behaviour)
 {
     Behaviours.Add(behaviour);
 }
Exemplo n.º 29
0
 public Succeeder(string name, IBehaviour <TContext> child) : base(name, child)
 {
 }
Exemplo n.º 30
0
 public static Initialize Create(IActorRef target, IBehaviour message = null)
 {
     return(new Initialize(message: message, target: target));
 }
Exemplo n.º 31
0
 // Adds child behaviours
 public void addBehaviour(IBehaviour child)
 {
     m_childBehaviours.AddLast(child);
 }
Exemplo n.º 32
0
 private void Destroy(IBehaviour behaviour)
 {
     behaviour.DoDestroy();
 }
Exemplo n.º 33
0
 public bool TryGetBehaviour(string abbreviatedName, out IBehaviour behaviour)
 {
     lock (Behaviours)
         return Behaviours.TryGetValue(abbreviatedName, out behaviour);
 }
Exemplo n.º 34
0
 public virtual void AddBehaviour( IBehaviour behaviour )
 {
 }
Exemplo n.º 35
0
        public bool AddBehaviour(IBehaviour behaviour)
        {
            Dictionary<string, IBehaviour> updatedBehaviours = new Dictionary<string, IBehaviour>(Behaviours);

            if (!updatedBehaviours.ContainsKey(behaviour.AbbreviatedName))
            {                    
                behaviour.Initialize(this);
                updatedBehaviours.Add(behaviour.AbbreviatedName, behaviour);
                Behaviours = updatedBehaviours;

                return true;
            }

            return false;
        }
Exemplo n.º 36
0
 protected override void OnInit(IBehaviour o)
 {
     Behaviour.AfterInit();
 }
Exemplo n.º 37
0
 private void Add(IBehaviour behaviour)
 {
     this.entity.Behaveable.AddBehaviour(behaviour);
 }
Exemplo n.º 38
0
 public SubTree(string name, IBehaviour <TContext> child) : base(name, child)
 {
 }
Exemplo n.º 39
0
 public void SetSteeringBehaviour(IBehaviour behaviour)
 {
     _steeringBehaviour = behaviour;
 }
Exemplo n.º 40
0
 public Cooldown(string name, IBehaviour <TContext> child, int cooldownTimeInMilliseconds) : base(name, child)
 {
     CooldownTimeInMilliseconds = cooldownTimeInMilliseconds;
 }
Exemplo n.º 41
0
 public void AddBehaviour(IBehaviour behaviour)
 {
     behaviour.Machine = Machine;
     behaviours.Add(behaviour);
 }
Exemplo n.º 42
0
 public override void Init(ControllerSettings settings)
 {
     base.Init(settings);
     _behaviour = ((AIControllerSettings)settings).Behaviour;
     _behaviour.Init(this);
 }
Exemplo n.º 43
0
 public Node(IBehaviour parent)
 {
     _actions = new List <IBehaviour>();
     _parent  = parent;
     _index   = 0;
 }
Exemplo n.º 44
0
 /// <summary>
 /// Adds a new behaviour to the <see cref="BehaviourCollection"/>
 /// </summary>
 /// <param name="dependencyObject">The <see cref="DependencyObject"/> to which to add to</param>
 /// <param name="behaviour">The behaviour to add</param>
 internal static void AddBehaviour(DependencyObject dependencyObject, IBehaviour behaviour)
 {
     GetBehaviours(dependencyObject).Add(behaviour);
 }
Exemplo n.º 45
0
 //a method to add Behaviours to the entity
 public abstract void AddBehaviour(IBehaviour pBehaviour);
 private AgentMoc(ActorPaths actorPaths, long time, bool debug, IActorRef principal, IBehaviour behaviour, GuardianType guardianType)
     : base(actorPaths: actorPaths, time: time, debug: debug, principal: principal)
 {
     _actorPaths   = actorPaths;
     _guardianType = guardianType;
     this.InitializeAgent(behaviour: behaviour);
 }
Exemplo n.º 47
0
 private void CheckForBossAttack(GameObject sword)
 {
     if (player)
     {
         if (sword.Texture == Boss1Swordtexture)
         {
             behaviourStats = GameObject.GetBehaviourOfType("StatBehaviour");
             (behaviourStats as StatBehaviour).TestosDown(1);
         }
     }
 }
Exemplo n.º 48
0
 public void AddBehaviour(IBehaviour behaviour)
 {
 }
Exemplo n.º 49
0
 public RouteBuilder WithBehaviour(IBehaviour behaviour)
 {
     actions.Add((r) => r.Behaviours.Add(behaviour));
     return(this);
 }
Exemplo n.º 50
0
 /// <summary>
 /// Updates the clock of this behaviour based on an another behaviour
 /// </summary>
 /// <param name="behaviour"></param>
 public virtual void updateNext(IBehaviour behaviour)
 {
     if (behaviour != null && behaviour.GetType() == this.GetType())
     {
         this.TIME = behaviour.TIME;
     }
 }
Exemplo n.º 51
0
 /// <summary>
 /// Add a behaviour to this HaptiQ
 /// </summary>
 /// <param name="behaviour"></param>
 public void addBehaviour(IBehaviour behaviour)
 {
     lock (_behaviours)
     {
         _behaviours.Add(behaviour);
     }
 }