예제 #1
0
 public BehaviourTreeNode(
     Game1 game,
     GameObject parent, 
     BehaviourNodeType type)
 {
     this._type = type;
     this._state = BehaviourNodeState.Ready;
     this._children = new List<BehaviourTreeNode>();
     this._behaviourComponent = (BehaviourComponent)parent.GetComponent(ComponentType.Behaviour);
     this._parent = parent;
     this._game = game;
 }
예제 #2
0
        public static GameObject BuildComputerControlledEntity(
            Game1 game,
            int playerNumber,
            Color playerColor,
            Vector2 position,
            float rotation,
            Vector2 scale,
            float maxGroundSpeed,
            float maxAirSpeed,
            SpriteType spriteType,
            List<Shape> boundingBoxes,
            Dictionary<ActionDefinition, ActionInfo> actionsInformationList,
            GameObject opponent)
        {
            GameObject entity = DynamicEntityFactory.BuildCharacterEntity(
                game,
                playerNumber,
                playerColor,
                position,
                rotation,
                scale,
                maxGroundSpeed,
                maxAirSpeed,
                spriteType,
                boundingBoxes,
                actionsInformationList
                );

            AIControllerComponent aiComponent = new AIControllerComponent(entity);
            AStarComponent aStarComponent = new AStarComponent(entity);
            BehaviourComponent behaviourComponent = new BehaviourComponent(
                entity,
                BehaviourFactory.Easy(
                    game,
                    entity,
                    opponent
                ));
            SoundComponent soundComponent = new SoundComponent(entity);

            entity.AddComponent(aiComponent);
            entity.AddComponent(aStarComponent);
            entity.AddComponent(behaviourComponent);

            return entity;
        }