protected override void OnCreate()
    {
        var world = World.DefaultGameObjectInjectionWorld;

        updatePlayerStateSystem = world.GetOrCreateSystem <UpdatePlayerStateSystem>();
        stateIdleSystem         = world.GetOrCreateSystem <StateIdleSystem>();
        stateMovingSystem       = world.GetOrCreateSystem <StateMovingSystem>();
        stateAttackingSystem    = world.GetOrCreateSystem <StateAttackingSystem>();
        enemyTargetSystem       = world.GetOrCreateSystem <EnemyTargetSystem>();
        stateDyingSystem        = world.GetOrCreateSystem <StateDyingSystem>();
        stateDashingSystem      = world.GetOrCreateSystem <StateDashingSystem>();
        dashSystem           = world.GetOrCreateSystem <DashSystem>();
        moveVelocitySystem   = world.GetOrCreateSystem <MoveVelocitySystem>();
        stateReloadingSystem = world.GetOrCreateSystem <StateReloadingSystem>();

        retrieveGunEventSystem = world.GetOrCreateSystem <RetrieveGunEventSystem>();

        var initialize = world.GetOrCreateSystem <LateInitializeManager>();

        initialize.AddSystemToUpdateList(updatePlayerStateSystem);
        initialize.AddSystemToUpdateList(stateIdleSystem);
        initialize.AddSystemToUpdateList(stateMovingSystem);
        initialize.AddSystemToUpdateList(stateAttackingSystem);
        initialize.AddSystemToUpdateList(enemyTargetSystem);
        initialize.AddSystemToUpdateList(stateDyingSystem);
        initialize.AddSystemToUpdateList(stateReloadingSystem);
        initialize.AddSystemToUpdateList(stateDashingSystem);
        initialize.AddSystemToUpdateList(retrieveGunEventSystem);
        initialize.AddSystemToUpdateList(dashSystem);
        initialize.AddSystemToUpdateList(moveVelocitySystem);

        initialize.SortSystemUpdateList();
    }
Beispiel #2
0
        private IProduct ParseProduct(string productIDString)
        {
            if (!uint.TryParse(productIDString, out uint productID))
            {
                return(null);
            }

            return(DashSystem.GetProductByID(productID));
        }
Beispiel #3
0
        private static void Main()
        {
            IDashSystem   dashSystem = new DashSystem();
            IDashSystemUI ui         = new DashSystemCLI(dashSystem);

            new DashSystemController(ui, dashSystem);

            ui.Start();
        }
    public PlayerGroundedSuperState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _player       = player;

        _input           = player.Input;
        _data            = player.Data;
        _groundDetector  = player.EnvironmentDetector.GroundDetector;
        _ceilingDetector = player.EnvironmentDetector.CeilingDetector;
        _dashSystem      = player.DashSystem;
    }
Beispiel #5
0
    public PlayerWallSuperState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _player       = player;

        _data           = player.Data;
        _movement       = player.Movement;
        _input          = player.Input;
        _groundDetector = player.EnvironmentDetector.GroundDetector;
        _wallDetector   = player.EnvironmentDetector.WallDetector;
        _dashSystem     = player.DashSystem;
    }
    public PlayerLandState(PlayerFSM stateMachine, Player player) : base(stateMachine, player)
    {
        _stateMachine = stateMachine;
        _player       = player;
        _animator     = player.PlayerAnimator;

        _input      = player.Input;
        _data       = player.Data;
        _sfx        = player.SFX;
        _dashSystem = player.DashSystem;
        _jumpDust   = player.Visuals.JumpDust;
    }
Beispiel #7
0
    public PlayerGroundAttackState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _animator     = player.PlayerAnimator;

        _movement       = player.Movement;
        _data           = player.Data;
        _input          = player.Input;
        _weaponSystem   = player.WeaponSystem;
        _dashSystem     = player.DashSystem;
        _weaponData     = player.WeaponSystem.EquippedWeapon;
        _groundDetector = player.EnvironmentDetector.GroundDetector;
    }
Beispiel #8
0
    public PlayerJumpState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _player       = player;
        _animator     = player.PlayerAnimator;

        _movement       = player.Movement;
        _input          = player.Input;
        _data           = player.Data;
        _groundDetector = player.EnvironmentDetector.GroundDetector;
        _dashSystem     = player.DashSystem;
        _sfx            = player.SFX;
        _jumpDust       = player.Visuals.JumpDust;
    }
    public PlayerFallingState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _player       = player;
        _animator     = player.PlayerAnimator;

        _movement          = player.Movement;
        _data              = player.Data;
        _input             = player.Input;
        _groundDetector    = player.EnvironmentDetector.GroundDetector;
        _wallDetector      = player.EnvironmentDetector.WallDetector;
        _aboveWallDetector = player.EnvironmentDetector.AboveWallDetector;

        _dashSystem = player.DashSystem;
    }
Beispiel #10
0
 private IUser ParseUser(string username)
 {
     return(DashSystem.GetUserByUsername(username));
 }
Beispiel #11
0
    protected override void OnUpdate()
    {
        Entities.WithNone <SendRpcCommandRequestComponent>().ForEach((Entity reqEnt, ref GoInGameRequest req, ref ReceiveRpcCommandRequestComponent reqSrc) =>
        {
            PostUpdateCommands.AddComponent <NetworkStreamInGame>(reqSrc.SourceConnection);
            UnityEngine.Debug.Log(String.Format("Server setting connection {0} to in game", EntityManager.GetComponentData <NetworkIdComponent>(reqSrc.SourceConnection).Value));
            var ghostCollection = GetSingleton <GhostPrefabCollectionComponent>();


            //var serverPrefabs = EntityManager.GetBuffer<GhostPrefabBuffer>(ghostCollection.serverPrefabs);
            //for (int ghostId = 0; ghostId < serverPrefabs.Length; ++ghostId)
            //{
            //    if (EntityManager.HasComponent<MovableCubeComponent>(serverPrefabs[ghostId].Value))
            //        prefab = serverPrefabs[ghostId].Value;
            //}



            // old implementation, was deprecated annoyingly
            //var ghostId = NetAgentGhostSerializerCollection.FindGhostType<AgentSnapshotData>();
            var ghostId = 0;
            var prefab  = EntityManager.GetBuffer <GhostPrefabBuffer>(ghostCollection.serverPrefabs)[ghostId].Value;
            var player  = EntityManager.Instantiate(prefab);

            Entity sword  = SwordSystem.AddAbility(player, EntityManager, ghostCollection);
            Entity shield = ShieldSystem.AddAbility(player, EntityManager, ghostCollection);


            ghostId     = 4;
            prefab      = EntityManager.GetBuffer <GhostPrefabBuffer>(ghostCollection.serverPrefabs)[ghostId].Value;
            var hurtbox = EntityManager.Instantiate(prefab);
            EntityManager.SetComponentData(hurtbox, new OwningPlayer {
                Value = player
            });
            EntityManager.AddBuffer <Hit>(hurtbox);

            ghostId          = 5;
            prefab           = EntityManager.GetBuffer <GhostPrefabBuffer>(ghostCollection.serverPrefabs)[ghostId].Value;
            var shieldHitbox = EntityManager.Instantiate(prefab);
            EntityManager.SetComponentData(shieldHitbox, new OwningPlayer {
                Value = player
            });
            EntityManager.SetComponentData(shieldHitbox, new AssociatedEntity {
                Value = shield
            });
            EntityManager.AddBuffer <Hit>(shieldHitbox);


            EntityManager.SetComponentData(player, new AgentComponent {
                PlayerId = EntityManager.GetComponentData <NetworkIdComponent>(reqSrc.SourceConnection).Value
            });

            InitializeAgent(player);

            PostUpdateCommands.AddBuffer <AgentInput>(player);

            PostUpdateCommands.SetComponent(reqSrc.SourceConnection, new CommandTargetComponent {
                targetEntity = player
            });

            PostUpdateCommands.DestroyEntity(reqEnt);

            Entity dash1 = DashSystem.AddAbility(player, 1, 1000, 7, new float3(0, 0, 1), KeyCode.A, EntityManager, ghostCollection);
            Entity dash2 = DashSystem.AddAbility(player, 1, 1000, 7, new float3(0, 0, -1), KeyCode.S, EntityManager, ghostCollection);
            Entity dash3 = DashSystem.AddAbility(player, 1, 1000, 7, new float3(1, 0, 0), KeyCode.D, EntityManager, ghostCollection);
            Entity dash4 = DashSystem.AddAbility(player, 1, 1000, 7, new float3(-1, 0, 0), KeyCode.F, EntityManager, ghostCollection);



//#if (!UNITY_EDITOR)
            //GameObject animate_prefab = Resources.Load<GameObject>("Prefabs/gladiator");
            //GameObject obj = UnityEngine.Object.Instantiate(animate_prefab);
            // setup pointer to entity from object
            //obj.GetComponent<PlayerMono>().entity = player;
            // setup pointers to entities from sword object
            //var swordObj = obj.transform.Find("CharArmature/Pelvis/Ribcage/Chest/Shoulder.R/UpperArm.R/Forearm.R/Hand.R/SwordArmature/Bone/Sword");
            //SwordMono swordMono = swordObj.GetComponent<SwordMono>();
            //swordMono.entity = sword;
            //swordMono.player = player;
            //EntityManager.AddComponentObject(sword, swordMono);

            //var shieldObj = obj.transform.Find("CharArmature/Pelvis/Ribcage/Chest/Shoulder.L/UpperArm.L/Forearm.L/ShieldArmature/Bone.001/Shield");
            //ShieldMono shieldMono = shieldObj.GetComponent<ShieldMono>();
            //shieldMono.entity = shield;
            //shieldMono.player = player;
            //EntityManager.AddComponentObject(shield, shieldMono);

            //obj.transform.localScale *= 0.5f;
            //EntityManager.AddComponentObject(player, obj);
            PostUpdateCommands.AddComponent <AnimationInitialized>(player);
//#endif
        });
    }