Esempio n. 1
0
        public static void Main()
        {
            IInputReader consoleReader = new ConsoleReader();
            var          consoleWriter = new ConsoleWriter
            {
                AutoFlush = true
            };

            ICommandDispatcher commandDispatcher = new CommandDispatcher();
            IGroupFactory      groupFactory      = new GroupFactory();
            IWarEffectFactory  warEffectFactory  = new WarEffectFactory();
            IAttackFactory     attackFactory     = new AttackFactory();
            IDatabase          db = new EngineDb();

            var engine = new Engine(
                consoleReader,
                consoleWriter,
                commandDispatcher,
                groupFactory,
                warEffectFactory,
                attackFactory,
                db);

            engine.Start();
        }
Esempio n. 2
0
 private List <GameObject> isInuse = new List <GameObject>();    //正在使用的粒子系统
 public static AttackFactory getInstance()
 {
     if (attackFactory == null)
     {
         attackFactory = new AttackFactory();
     }
     return(attackFactory);
 }
Esempio n. 3
0
 public Hero(int instanceId, HeroStatsConfig stats)
 {
     InstanceId       = instanceId;
     Team             = stats.Team;
     HealthPoints     = new HealthPoints(stats.HealthPoints);
     MaxMovementForce = stats.MaxMovementForce;
     Attack           = AttackFactory.GetAttack(stats.AttackConfig);
     Ability          = AbilityFactory.GetAbility(stats.AbilityConfig);
 }
Esempio n. 4
0
        public static void Main(string[] args)
        {
            IBlobFactory blobFactory = new BlobFactory();
            IAttackFactory attackFactory = new AttackFactory();
            IBehaviorFactory behaviorFactory = new BehaviorFactory();
            IInputReader reader = new ConsoleReader();
            IOutputWriter writer = new ConsoleWriter();

            IEngine engine = new Engine(blobFactory, attackFactory, behaviorFactory, reader, writer);
            engine.Run();
        }
Esempio n. 5
0
        public static void Main()
        {
            IRepository           repository         = new Repository();
            IBehaviourFactory     behaviourFactory   = new BehaviorFactory();
            IAttackFactory        attackFactory      = new AttackFactory();
            ICommandInterpretable commandInterpreter =
                new CommandInterpreter(repository, behaviourFactory, attackFactory);
            IRunable engine = new Engine(commandInterpreter);

            engine.Run();
        }
Esempio n. 6
0
        public static void Main(string[] args)
        {
            IUserInterface userInterface = new ConsoleUserInterface();
            IBlobFactory blobFactory = new BlobFactory();
            IBehaviorFactory behaviorFactory = new BehaviorFactory();
            IAttackFactory attackFactory = new AttackFactory();
            IDatabase database = new Database();

            IEngine engine = new Engine(userInterface,attackFactory,blobFactory,behaviorFactory,database);

            engine.Run();
        }
Esempio n. 7
0
        public static void Main(string[] args)
        {
            IUserInterface   userInterface   = new ConsoleUserInterface();
            IBlobFactory     blobFactory     = new BlobFactory();
            IBehaviorFactory behaviorFactory = new BehaviorFactory();
            IAttackFactory   attackFactory   = new AttackFactory();
            IDatabase        database        = new Database();

            IEngine engine = new Engine(userInterface, attackFactory, blobFactory, behaviorFactory, database);

            engine.Run();
        }
Esempio n. 8
0
        public static void Main(string[] args)
        {
            IBlobFactory     blobFactory     = new BlobFactory();
            IAttackFactory   attackFactory   = new AttackFactory();
            IBehaviorFactory behaviorFactory = new BehaviorFactory();
            IReader          reader          = new ConsoleReader();
            IWriter          writer          = new ConsoleWriter();

            IEngine engine = new Engine(blobFactory, attackFactory, behaviorFactory, reader, writer);

            engine.Run();
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            ICombatHandler combatHandler = new CombatHandler();

            IOutputWriter writer = new OutputWriter();
            IInputReader  reader = new InputReader();

            IBehaviourFactory behaviourFactory = new BehaviourFactory();
            IBlobFactory      blobFactory      = new BlobFactory();
            IAttackFactory    attackFactory    = new AttackFactory();
            IEngine           engine           = new Engine.Engine(reader, writer, blobFactory, behaviourFactory, attackFactory, combatHandler);

            engine.Run();
        }
Esempio n. 10
0
        private void OnRequestNewAttackHud(MsgRequestNewAttackHud obj)
        {
            lState        = LocalState.showOpened;
            returnButton  = false;
            confirmButton = false;

            learnings = obj.oAprendiz.GolpesPorAprender;

            showHud.Start(AttackFactory.GetAttack(learnings[0].Nome));

            SupportSingleton.Instance.InvokeOnCountFrame(() =>
            {
                MessageAgregator <MsgSendExternaPanelCommand> .AddListener(OnReceiveExternalCommands);
            }, 3);
        }
Esempio n. 11
0
        static void Main()
        {
            IInputController inputController = new ConsoleInputController();
            IRenderer        renderer        = new ConsoleRenderer();

            ICommandFactory  commandFactory  = new CommandFactory();
            IBlobFactory     blobFactory     = new BlobFactory();
            IAttackFactory   attackFactory   = new AttackFactory();
            IBehaviorFactory behaviorFactory = new BehaviorFactory();

            IEngine engine = new Engine(renderer, inputController, commandFactory, blobFactory, attackFactory,
                                        behaviorFactory);

            engine.Run();
        }
Esempio n. 12
0
        public GameObject Spawn(GameObject spawner)
        {
            AbstractPowerUpFactory powerUpFactory;

            type++;

            switch (type)
            {
            case 0:
                powerUpFactory = new AttackFactory();
                break;

            case 1:
                powerUpFactory = new DefenseFactory();
                break;

            case 2:
                powerUpFactory = new HealthFactory();
                break;

            case 3:
                powerUpFactory = new SpeedFactory();
                type           = -1;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            int     percent = rnd.Next(100);
            Vector2 size    = spawner.transform.size * new Vector2(0.6f, 0.7f);

            if (percent < 50)
            {
                powerUp = powerUpFactory.CreateTemporaryPowerUp(0, 0, size.X, size.Y);
            }
            else
            {
                powerUp = powerUpFactory.CreatePermanentPowerUp(0, 0, size.X, size.Y);
            }
            GameObject.Instantiate(powerUp, spawner);
            return(powerUp);
        }
Esempio n. 13
0
        static void Main(string[] args)
        {
            IDatabase database = new Database.Database();

            IAttackFactory attackFactory = new AttackFactory();

            IBehaviourFactory behaviourFactory = new BehaviourFactory();

            IBlobFactory blobFactory = new BlobFactory();

            IController controller = new Controller(database, blobFactory, attackFactory, behaviourFactory);

            ICommandHandler commandHandler = new CommandHandler(controller);

            IReader reader = new Reader();
            IWriter writer = new Writer();

            IEngine engine = new Engine(commandHandler, reader, writer);

            engine.Run();
        }
Esempio n. 14
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        Main m = GetNode <Main>("/root/main");

        _input = new FPSInput();

        _hudState            = new HUDPlayerState();
        _hudState.health     = 80;
        _hudState.ammoLoaded = 999;
        _hudState.weaponName = "Stakegun";

        // find Godot scene nodes
        _body       = GetNode <KinematicWrapper>("actor_base");
        _body.actor = this;
        _body.HideModels();

        _head = GetNode <Spatial>("actor_base/head");

        _laserDot = GetNode <LaserDot>("laser_dot");
        _laserDot.CustomInit(_head, uint.MaxValue, 1000);

        _thrownSword = m.factory.SpawnThrownSword(false);
        m.AddOrphanNode(_thrownSword);

        // init components
        _fpsCtrl = new FPSController(_body, _head);


        // Inventory
        _inventory = new ActorInventory();
        _inventory.Init(_head, 1);

        // Add weapons
        _inventory.AddWeapon(AttackFactory.CreatePlayerShotgun(_head, _body));
        _inventory.AddWeapon(AttackFactory.CreateStakegun(_head, _body));

        m.cam.AttachToTarget(_head);
    }
Esempio n. 15
0
        public CubesAssets(Player a_player, ViewClasses.GameAssets a_assets, Map a_map, PathFinder a_pathfinder)
        {
            m_ownerID = a_player.m_playerID;
            m_race    = a_player.m_race;

            m_cube = new Cube(m_ownerID, a_assets.c_cube, 10, 10, Vector3.Zero, 10, a_player.AddUnderAttackPosition);

            m_cube.m_moveBehavior   = MovementFactory.m_standardMovement;
            m_cube.m_attackBehavior = new StandardAttack(m_cube, 1, 1, 3);

            m_cube.m_buildBehavior = BuildFactory.CreateNewVisibleBuild(a_player, m_cube, 1, a_map, a_pathfinder);

            m_barbarian = new Barbarian(m_ownerID, a_assets.c_barbarian, 30, 30, Vector3.Zero, 10, a_player.AddUnderAttackPosition);

            m_barbarian.m_moveBehavior   = MovementFactory.m_standardMovement;
            m_barbarian.m_attackBehavior = AttackFactory.CreateNewStandardAttack(m_barbarian, 1, 5, 3);

            m_extractor = new Extractor(m_ownerID, a_assets.c_extractor, 500, 500, Vector3.Zero, a_player.AddUnderAttackPosition);

            m_igloo = new CubeIgloo(m_ownerID, a_assets.c_igloo, 100, 100, Vector3.Zero, a_player.AddUnderAttackPosition);

            m_barrack = new Barrack(m_ownerID, a_assets.c_barrack, 200, 200, Vector3.Zero, a_player.AddUnderAttackPosition);
        }
Esempio n. 16
0
 public GameExecutor()
 {
     this.blobs           = new Dictionary <string, Blob>();
     this.behaviorFactory = new BehaviorFactory();
     this.attackFactory   = new AttackFactory();
 }
Esempio n. 17
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        //_main = GetNode<Main>("/root/main");
        _main = Main.i;

        _input = new FPSInput();

        _hudState            = new HUDPlayerState();
        _hudState.health     = 80;
        _hudState.ammoLoaded = 999;
        _hudState.weaponName = "Stakegun";

        // find Godot scene nodes
        _body       = GetNode <KinematicWrapper>("actor_base");
        _body.actor = this;
        _body.HideModels();

        _head        = GetNode <Spatial>("actor_base/head");
        _meleeVolume = _head.GetNode <MeleeHitVolume>("melee_hit_volume");

        ///////////////////////////////////////
        // view models

        // grab hands placeholder and attach it to the head node
        _handsPlaceholder = GetNode <ViewModel>("hands_placeholder");
        Transform t = _handsPlaceholder.GlobalTransform;

        RemoveChild(_handsPlaceholder);
        _head.AddChild(_handsPlaceholder);
        _handsPlaceholder.GlobalTransform = t;
        _handsPlaceholder.SetEnabled(false);

        // same for placeholder gun
        _gunPlaceholder = GetNode <ViewModel>("view_placeholder_gun");
        ZqfGodotUtils.SwapSpatialParent(_gunPlaceholder, _head);
        _gunPlaceholder.SetEnabled(true);
        _viewModel = _gunPlaceholder;

        _laserDot = GetNode <LaserDot>("laser_dot");
        _laserDot.CustomInit(_head, uint.MaxValue, 1000);

        _thrownSword = _main.factory.SpawnThrownSword(false);
        _main.AddOrphanNode(_thrownSword);

        // init components
        _fpsCtrl = new FPSController(_body, _head);


        // Inventory
        _inventory = new ActorInventory();
        _inventory.Init(_head, 1);

        // Add weapons
        SwordThrowProjectile prj = _main.factory.SpawnThrownSword();

        _inventory.AddWeapon(AttackFactory.CreatePlayerMelee(_meleeVolume, prj, _laserDot));
        _inventory.AddWeapon(AttackFactory.CreatePlayerShotgun(_head, _body));
        _inventory.AddWeapon(AttackFactory.CreateStakegun(_head, _body));
        _inventory.AddWeapon(AttackFactory.CreateLauncher(_head, _body));
        _inventory.AddWeapon(new InvWeapGodhand(_head, _laserDot));
        _inventory.SelectWeaponByIndex(1);

        _main.cam.AttachToTarget(_head, Vector3.Zero, GameCamera.ParentType.Player);

        if (_entId == 0)
        {
            // no id previous set, request one
            _entId = _main.game.ReserveActorId(1);
            _main.game.RegisterActor(this);
        }

        _main.Broadcast(GlobalEventType.PlayerSpawned, this);
    }
Esempio n. 18
0
 private void Start()
 {
     attackFactory = AttackFactory.getInstance();
 }
Esempio n. 19
0
 private Vector3 attackPosOffset = new Vector3(0f, 0.3f, 0f); //发射位置相较于人物位置的偏移
 private void Start()
 {
     pos           = this.gameObject.transform;
     attackFactory = AttackFactory.getInstance();
     _animation    = this.gameObject.GetComponent <Animation>();
 }
Esempio n. 20
0
        public static Entity CreateEntity(Dictionary <string, object> entityProperties)
        {
            Entity    entity      = null;
            string    textureName = (string)entityProperties["textureName"];
            Texture2D texture     = TextureFactory.GetTexture(textureName);

            string colorName = (string)entityProperties["color"];
            Color  color     = System.Drawing.Color.FromName(colorName).ToXNA();

            Dictionary <string, object> movementPatternProperties = null;
            MovementPattern             movement = null;

            if (entityProperties.ContainsKey("movementPattern"))
            {
                movementPatternProperties = (Dictionary <string, object>)entityProperties["movementPattern"];
                movement = MovementPatternFactory.CreateMovementPattern(movementPatternProperties);
            }

            string enemyType            = (string)entityProperties["entityType"];
            string entityClassification = (string)entityProperties["entityType"] != "player" ? "enemy" : "player";

            int hp = Convert.ToInt32((float)entityProperties["hp"]);

            List <Attack> attacks = null;

            if (entityProperties["attacks"] is List <object> )
            {
                attacks = AttackFactory.CreateAttacks((List <object>)entityProperties["attacks"]);
            }
            else if (entityProperties["attacks"] is Dictionary <string, object> )
            {
                attacks = AttackFactory.CreateAttacks((Dictionary <string, object>)entityProperties["attacks"]);
            }

            switch (entityClassification)
            {
            case "player":
                entity = new Player(texture, color, movement, hp, attacks);
                entity.SpawnPosition = new Vector2((float)movementPatternProperties["spawnXPosition"], (float)movementPatternProperties["spawnYPosition"]);
                break;

            case "enemy":
                PowerUp powerUp = PowerUpFactory.CreatePowerUp((Dictionary <string, object>)entityProperties["powerUp"]);

                switch (enemyType)
                {
                case "simpleGrunt":
                    entity = new SimpleGrunt(texture, color, movement, powerUp, hp, attacks);
                    break;

                case "complexGrunt":
                    entity = new ComplexGrunt(texture, color, movement, powerUp, hp, attacks);
                    break;

                case "midBoss":
                    entity = new MidBoss(texture, color, movement, powerUp, hp, attacks);
                    break;

                case "finalBoss":
                    List <Attack> phase2Attacks = null;
                    if (entityProperties["phase2Attacks"] is List <Dictionary <string, object> > )
                    {
                        phase2Attacks = AttackFactory.CreateAttacks((List <object>)entityProperties["phase2Attacks"]);
                    }
                    else if (entityProperties["phase2Attacks"] is Dictionary <string, object> )
                    {
                        phase2Attacks = AttackFactory.CreateAttacks((Dictionary <string, object>)entityProperties["phase2Attacks"]);
                    }

                    entity = new FinalBoss(texture, color, movement, powerUp, hp, attacks, phase2Attacks);
                    break;
                }

                break;

            default:
                throw new Exception("Invalid Entity");
            }

            if (entity.Movement != null)
            {
                entity.Movement.Parent = entity;
            }

            return(entity);
        }