Esempio n. 1
0
        internal static GameEntity CreateItem(this GameContext context, float x, float y)
        {
            var entity = context.CreateEntity();

            entity.isItem = true;
            entity.ReplacePosition(new Vector2(x, y));

            return(entity);
        }
        public static void CreateBlockPiece(this GameContext gameContext, int x, int y)
        {
            GameEntity gameEntity = gameContext.CreateEntity();

            gameEntity.AddGamePosition(x, y);
            gameEntity.isGamePiece = true;
            gameEntity.isGameBlock = true;
            gameEntity.AddGameAsset("block");
            gameEntity.isGameView = true;
        }
Esempio n. 3
0
        public static IEntity CreateShot(GameContext contexts, Vector3 position, Quaternion rotation)
        {
            var entity = contexts.CreateEntity();

            entity.AddPosition(position);
            entity.AddRotation(rotation);
            entity.AddElapsedTime(0f);
            entity.isShot = true;

            return(entity);
        }
Esempio n. 4
0
        public static IEntity CreatePlayer(GameContext context, Vector3 position, Quaternion forward)
        {
            var entity = context.CreateEntity();

            entity.AddRotation(forward);
            entity.AddPosition(position);
            entity.AddSpeed(context.gameSettings.value.PlayerMoveSpeed);
            entity.AddSpeedRotation(context.gameSettings.value.PlayerRotationSpeed);
            entity.AddShooting(0f, false);
            entity.isPlayer = true;

            return(entity);
        }
        public static void CreateNormalPiece(this GameContext gameContext, int x, int y)
        {
            GameEntity gameEntity = gameContext.CreateEntity();

            gameEntity.AddGamePosition(x, y);
            gameEntity.isGamePiece = true;
            if (pieceTypes == null)
            {
                pieceTypes = (PieceType[])Enum.GetValues(typeof(PieceType));
                random     = new Random();
            }
            PieceType pieceType = pieceTypes[random.Next(0, pieceTypes.Length)];

            gameEntity.AddGameAsset("piece" + pieceType.ToString());
            gameEntity.isGameView = true;
        }
Esempio n. 6
0
        public void Initialize()
        {
            GameEntity boardEntity = gameContext.CreateEntity();

            boardEntity.AddGameBoard(Config.boardCol, Config.boardRow);
        }