Exemplo n.º 1
0
 protected override void OnCreate()
 {
     _UnitQuery         = GetEntityQuery(typeof(UnitData));
     _SelectionSystem   = World.GetOrCreateSystem <SelectionSystem>();
     _ECBSystem         = World.GetOrCreateSystem <EndInitializationEntityCommandBufferSystem>();
     _BuildPhysicsWorld = World.GetOrCreateSystem <BuildPhysicsWorld>();
 }
Exemplo n.º 2
0
        private void PlacePlacable()
        {
            SelectionHitOBJ HitObj = SelectionSystem.getMouseFowardLocation(new GameObject[] { ScopedObject.gameObject }, false, GameManager.I.Constants.TerrainLayer);

            if (AlignToSurface == 0)
            {
                HitObj           = SelectionSystem.getMouseFowardLocation(new GameObject[] { ScopedObject.gameObject }, false, GameManager.I.Modular.ModularPieceTempLayer, GameManager.I.Constants.TerrainLayer);
                HitObj.HitNormal = Vector3.up;                 // clamp normal default
            }
            else if (AlignToSurface == 1)
            {
                HitObj = SelectionSystem.getMouseFowardLocation(new GameObject[] { ScopedObject.gameObject }, false, GameManager.I.Modular.ModularPieceTempLayer, GameManager.I.Constants.TerrainLayer);
            }
            else if (AlignToSurface == 2)
            {
                HitObj = SelectionSystem.getMouseFowardLocation(new GameObject[] { ScopedObject.gameObject }, false, GameManager.I.Modular.ModularPieceTempLayer, GameManager.I.Modular.ModularPieceLayer, GameManager.I.Constants.TerrainLayer);
            }

            ScopedObject.PlaceAtPos(HitObj.getHitPos(), SnapType, (AlignToSurface == 1 || AlignToSurface == 2)?(Vector3?)HitObj.HitNormal:null, (LocalSpace)?ScopedObject.LocalSpace:null, FastPlacementOffset);

            if (GameManager.I.Modular.ScopedSet != null)               // is not building in a set
            {
                ScopedObject.AutoStack(StackType, GameManager.I.Modular.ScopedSet);
            }
            else
            {
                ScopedObject.AutoStack(StackType, () => {
                    return(Management.GameManager.I.Modular.OverlappingModularSets(ScopedObject, (StackType == StackTypes.Boundary)));
                });
            }

            //UpdateVisualGrid ();
        }
Exemplo n.º 3
0
        public UIController(PuzzleEditor editor, SelectionSystem selection, Mode.Mode mode,
                            GameController controller, Transform canvas)
        {
            this.Editor     = editor;
            this.Selection  = selection;
            this.Mode       = mode;
            this.Controller = controller;

            this.Initialize(canvas);
        }
Exemplo n.º 4
0
        public CommandManager(
            Faction faction,
            IRtsInput rtsInput,
            ICommandExecutor commandExecutor,
            SelectionSystem selectionSystem)
        {
            this.faction         = faction;
            this.commandExecutor = commandExecutor;
            this.selectionSystem = selectionSystem;

            rtsInput.ActionOnUnit += OnActionOnUnit;
        }
Exemplo n.º 5
0
    void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }
        instance = this;

        selectionSystem = GetComponent <SelectionSystem>();
        unitSystem      = GetComponent <UnitSystem>();
        gridSystem      = GetComponent <GridSystem>();
        resourceSystem  = GetComponent <ResourceSystem>();
        xpSystem        = GetComponent <XpSystem>();
        buildingSystem  = GetComponent <BuildingSystem>();
    }
Exemplo n.º 6
0
 public FlightScene(
     Content content,
     EntityController entityController,
     Resolver <IComponentFactory> factories,
     Resolver <IComponentContainer> containers,
     SceneBuilder sceneBuilder,
     FlightPlanSystem flightPlanSystem,
     IComponentContainer <FlightPlan> flightPlans,
     ReactionControlSystem reactionControlSystem,
     SelectionSystem selectionSystem,
     AsteroidEditorTab asteroidEditorTab)
 {
     this.Content               = content;
     this.EntityController      = entityController;
     this.Factories             = factories;
     this.Containers            = containers;
     this.SceneBuilder          = sceneBuilder;
     this.FlightPlanSystem      = flightPlanSystem;
     this.FlightPlans           = flightPlans;
     this.ReactionControlSystem = reactionControlSystem;
     this.SelectionSystem       = selectionSystem;
     this.AsteroidEditorTab     = asteroidEditorTab;
 }
Exemplo n.º 7
0
        public static void EnemyUnitsCanNotBeCommanded()
        {
            EditorSceneManager.NewScene(NewSceneSetup.EmptyScene);
            var friendlyFaction = ScriptableObject.CreateInstance <Faction>();
            var enemyFaction    = ScriptableObject.CreateInstance <Faction>();

            var commandExecutorStub = new CommandExecutorStub();
            var rtsInputStub        = new RtsInputStub();
            var selectionSystem     = new SelectionSystem(rtsInputStub, friendlyFaction);

            new CommandManager(friendlyFaction, rtsInputStub, commandExecutorStub, selectionSystem);

            var friendlyUnit = new GameObject().AddComponent <Unit>();
            var enemyUnit    = new GameObject().AddComponent <Unit>();

            friendlyUnit.Faction = friendlyFaction;
            enemyUnit.Faction    = enemyFaction;

            rtsInputStub.TriggerSelectOnUnit(enemyUnit);
            rtsInputStub.TriggerActionOnUnit(friendlyUnit);

            Assert.IsEmpty(commandExecutorStub.commands);
        }
Exemplo n.º 8
0
 public Player(SelectionSystem selection) :
     base(selection)
 {
 }
Exemplo n.º 9
0
 public EditorUI(GameController controller, PuzzleEditor editor, SelectionSystem selection,
                 Mode.Mode mode, Transform canvas) :
     base(controller, editor, selection, mode, canvas)
 {
 }
Exemplo n.º 10
0
 public Editor(SelectionSystem selection) :
     base(selection)
 {
 }
Exemplo n.º 11
0
    protected override void OnCreate()
    {
        inputSystem     = World.GetOrCreateSystem <InputSystem>();
        selectionSystem = World.GetOrCreateSystem <SelectionSystem>();

        lockstepSystemGroup = World.GetOrCreateSystem <LockstepSystemGroup>();
        lockstepSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem <CommandExecutionSystem>());
        lockstepSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem <VolatileCommandSystem>());
        lockstepSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem <CommandableSafetySystem>());

        blockMovementSystem = World.GetOrCreateSystem <BlockMovementSystem>();

        onGroupCheckSystem = World.GetOrCreateSystem <OnGroupCheckSystem>();

        updateReachableHexListSystem = World.GetOrCreateSystem <UpdateReachableHexListSystem>();

        resourceSourceManagerSystem = World.GetOrCreateSystem <ResourceSourceManagerSystem>();
        triggerGatherSystem         = World.GetOrCreateSystem <TriggerGatherSystem>();

        dropPointSystem = World.GetOrCreateSystem <DropPointSystem>();

        triggerUpdateResBufferSystem = World.GetOrCreateSystem <TriggerUpdateResBufferSystem>();
        updateResourceBufferSystem   = World.GetOrCreateSystem <UpdateResourceBufferSystem>();


        updateOcupationMapSystem = World.GetOrCreateSystem <UpdateOcupationMapSystem>();
        updateDestinationSystem  = World.GetOrCreateSystem <UpdateDestinationSystem>();

        sightSystem = World.GetOrCreateSystem <SightSystem>();

        pathRefreshSystem     = World.GetOrCreateSystem <PathRefreshSystem>();
        pathFindingSystem     = World.GetOrCreateSystem <PathFindingSystem>();
        pathChangeIndexSystem = World.GetOrCreateSystem <PathChangeIndexSystem>();

        findPosibleTargetsSystem = World.GetOrCreateSystem <FindPosibleTargetsSystem>();
        findActionTargetSystem   = World.GetOrCreateSystem <FindActionTargetSystem>();

        findMovementTargetSystem = World.GetOrCreateSystem <FindMovementTargetSystem>();
        steeringSystem           = World.GetOrCreateSystem <SteeringSystem>();
        translationSystem        = World.GetOrCreateSystem <TranslationSystem>();
        movementFinisherSystem   = World.GetOrCreateSystem <MovementFinisherSystem>();



        collisionSystem = World.GetOrCreateSystem <CollisionSystem>();
        directionSystem = World.GetOrCreateSystem <DirectionSystem>();


        startActSystem = World.GetOrCreateSystem <StartActSystem>();
        removeReceivingActComponentsSystem = World.GetOrCreateSystem <RemoveReceivingActComponentsSystem>();
        initReceivingActComponentsSystem   = World.GetOrCreateSystem <InitReceivingActComponentsSystem>();
        attackSystem                = World.GetOrCreateSystem <AttackSystem>();
        receiveDamageSystem         = World.GetOrCreateSystem <ReceiveDamageSystem>();
        gatherSystem                = World.GetOrCreateSystem <GatherSystem>();
        extractResourceSystem       = World.GetOrCreateSystem <ExtractResourceSystem>();
        updateGathererAmmountSystem = World.GetOrCreateSystem <UpdateGathererAmmountSystem>();
        endActionSystem             = World.GetOrCreateSystem <EndActionSystem>();


        resourceSystem = World.GetOrCreateSystem <ResourceSystem>();


        deathSystem = World.GetOrCreateSystem <DeathSystem>();
        //simulationSystemGroup = World.GetOrCreateSystem<SimulationSystemGroup>();
        //simulationSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem<PathFindingSystem>());
        //simulationSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem<PathFollowSystem>());

        //lateSimulationSystemGroup = World.GetOrCreateSystem<LateSimulationSystemGroup>();

        //applicationSystemGroup = World.GetOrCreateSystem<ApplicationSystemGroup>();
    }
Exemplo n.º 12
0
 public Mode(SelectionSystem selection)
 {
     this.Selection = selection;
 }