コード例 #1
0
 public MeteorsManager(GameContext gameContext, IMeteorFactory meteorFactory, ICollisionSystem collisionSystem, SoundEffect incomingSoundEffect)
 {
     _gameContext         = gameContext ?? throw new ArgumentNullException(nameof(gameContext));
     _meteorFactory       = meteorFactory ?? throw new ArgumentNullException(nameof(meteorFactory));
     _collisionSystem     = collisionSystem ?? throw new ArgumentNullException(nameof(collisionSystem));
     _incomingSoundEffect = incomingSoundEffect ?? throw new ArgumentNullException(nameof(incomingSoundEffect));
 }
コード例 #2
0
 private void ColSystemChanged()
 {
     if (CS.ColSysName != ChooseCollision().ColSysName)
     {
         CS = null;
         CS = ChooseCollision();
     }
 }
コード例 #3
0
ファイル: GameState.cs プロジェクト: koniin/Drakborgen
 public GameState()
 {
     _collisionSystem = new ArcadeCollisionSystem(true);
     EntityWorld.RegisterUpdateSystems(new InputSystem(), new PhysicsSystem(), new AnimationSystem(new AnimationMapper()));
     EntityWorld.RegisterRenderSystem(new RenderSystem());
     _castle = new Castle();
     _miniMap = new MiniMap(20, 20, 16, "minimap", 2);
 }
コード例 #4
0
        private void Start()
        {
            // Initial size (metres), initial centre position, minimum node size (metres), looseness
            collisionSystem = new CollisionSystem()
            {
                worldSize    = worldSize.ToLFloat(),
                pos          = pos.ToLVector3(),
                minNodeSize  = minNodeSize.ToLFloat(),
                loosenessval = loosenessval.ToLFloat()
            };
            collisionSystem.DoStart(InterestingMasks, allTypes);
            //init prefab
            const int size = 4;

            void CreatePrefab(CBaseShape collider)
            {
                var prefab = new ColliderPrefab();

                prefab.parts.Add(new ColliderPart()
                {
                    transform = new CTransform2D(LVector2.zero),
                    collider  = collider
                });
                prefabs.Add(prefab);
            }

            for (int i = 1; i < size; i++)
            {
                for (int j = 1; j < size; j++)
                {
                    CreatePrefab(new CAABB(new LVector2(i, j)));
                    CreatePrefab(new COBB(new LVector2(i, j), LFloat.zero));
                    CreatePrefab(new CCircle(((i + j) * 0.5f).ToLFloat()));
                }
            }

            for (int i = 0; i < count; i++)
            {
                int  layerType = 0;
                var  rawColor  = Color.white;
                bool isStatic  = true;
                if (i < percent * count * 2)
                {
                    layerType = 1;
                    isStatic  = false;
                    rawColor  = Color.yellow;
                    if (i < percent * count)
                    {
                        rawColor  = Color.green;
                        layerType = 2;
                    }
                }

                var proxy = CreateType(layerType, isStatic, rawColor);
                collisionSystem.AddCollider(proxy);
            }
        }
コード例 #5
0
        // Token: 0x0600027D RID: 637 RVA: 0x000079FD File Offset: 0x00005BFD
        public void OnDrawGizmos()
        {
            ICollisionSystem collisionSystem = this.collisionSystem;

            if (collisionSystem != null)
            {
                collisionSystem.DrawGizmos();
            }
        }
コード例 #6
0
ファイル: Snake.cs プロジェクト: ahmedrzaman/Snake
        /// <summary>
        /// Constructor for our reptile
        /// </summary>
        /// <param name="lengthOfSnake">The starting length of our reptile</param>
        public Snake(ICollisionSystem collisionSystem, int lengthOfSnake, int gameAreaWidth, int gameAreaHeight)
        {
            _startingLength = lengthOfSnake;

            _bits = InitSnake(lengthOfSnake);

            _gameAreaWidth   = gameAreaWidth;
            _gameAreaHeight  = gameAreaHeight;
            _collisionSystem = collisionSystem;
        }
コード例 #7
0
    void Start()
    {
        OnPlayerReady.AddListener(HandleOnPlayerReady);
        loadOperations = new List <AsyncOperation>();
        Random.InitState(1);
        tileSize = 3 * Meteor.GetComponent <SpriteRenderer>().sprite.bounds.max.x;
        CS       = ChooseCollision();

        GenerateField();
        line = this.gameObject.AddComponent <LineRenderer>();
        // Set the width of the Line Renderer
        line.SetWidth(0.05F, 0.05F);
        // Set the number of vertex fo the Line Renderer
        line.positionCount = 2;
    }
コード例 #8
0
        public override void DoStart()
        {
            if (_instance != this)
            {
                Debug.LogError("Duplicate CollisionSystemAdapt!");
                return;
            }

            var collisionSystem = new CollisionSystem()
            {
                worldSize    = worldSize,
                pos          = pos,
                minNodeSize  = minNodeSize,
                loosenessval = loosenessval
            };

            Debug.Trace($"worldSize:{worldSize} pos:{pos} minNodeSize:{minNodeSize} loosenessval:{loosenessval}");
            this.collisionSystem = collisionSystem;
            collisionSystem.DoStart(collisionMatrix, allTypes);
            collisionSystem.funcGlobalOnTriggerEvent += GlobalOnTriggerEvent;
        }
コード例 #9
0
        public GameScreen(IScreenManager screenManager, int rendererWidth, int rendererHeight)
            : base(ScreenType.Screen)
        {
            _collisionSystem = new CollisionSystem();

            _snake = new Snake(_collisionSystem, 5, 60, 30);
            _foods = new List <Food>();

            _rendererWidth  = rendererWidth;
            _rendererHeight = rendererHeight;

            _screenManager = screenManager;

            foreach (var bit in _snake.GetBits())
            {
                _collisionSystem.Add(bit);
            }

            UpdateScore();

            _collisionSystem.OnCollisionDetected += CollisionSystem_OnCollisionDetected;
        }
コード例 #10
0
 public PlayerManager(IPlayerFactory playerFactory, ICollisionSystem collisionSystem)
 {
     _playerFactory   = playerFactory ?? throw new ArgumentNullException(nameof(playerFactory));
     _collisionSystem = collisionSystem ?? throw new ArgumentNullException(nameof(collisionSystem));
 }
コード例 #11
0
 public BonusManager(GameContext gameContext, IBonusFactory bonusFactory, ICollisionSystem collisionSystem)
 {
     _gameContext     = gameContext ?? throw new ArgumentNullException(nameof(gameContext));
     _bonusFactory    = bonusFactory ?? throw new ArgumentNullException(nameof(bonusFactory));
     _collisionSystem = collisionSystem ?? throw new ArgumentNullException(nameof(collisionSystem));
 }
コード例 #12
0
 public PlayerProjectilesManager(IProjectileFactory projectileFactory, ICollisionSystem collisionSystem)
 {
     _projectileFactory = projectileFactory ?? throw new ArgumentNullException(nameof(projectileFactory));
     _collisionSystem   = collisionSystem ?? throw new ArgumentNullException(nameof(collisionSystem));
 }
コード例 #13
0
 public EnemiesManager(IEnemyFactory enemyFactory, ICollisionSystem collisionSystem)
 {
     _enemyFactory    = enemyFactory ?? throw new ArgumentNullException(nameof(enemyFactory));
     _collisionSystem = collisionSystem ?? throw new ArgumentNullException(nameof(collisionSystem));
 }