Exemplo n.º 1
0
        private void Load(BinaryReader br, bool isMultiplayer)
        {
            this.sizeXbits = br.ReadInt32();
            this.sizeYbits = br.ReadInt32();
            this.sizeZbits = br.ReadInt32();

            sizeX = 1 << sizeXbits;
            sizeY = 1 << sizeYbits;
            sizeZ = 1 << sizeZbits;

            if (isMultiplayer == false)
            {
                string gameplayId = br.ReadString();

                gameplay = GameplayFactory.GetGameplayById(gameplayId);
                gameplay.Init(this);
                gameplay.Load(br);
            }
            else
            {
                gameplay.Init(this);
            }

            configSurroundings = new ConfigSurroundings();
            configSurroundings.Load(br);
        }
        public CandyAttributesComponent AddCandyEntity(Coordinate coord, Candy properties)
        {
            Vector2 position = this.gameLogic.CalculateCandyPostion(coord);

            var candyEntity = GameplayFactory.CreateCandy(this.Owner.Scene, position, properties.Type, properties.Color);

            candyEntity.Name += "_" + this.candyCounter;
            var candyTouch      = new CandyTouchComponent();
            var candyAttributes = new CandyAttributesComponent(coord, properties);

            candyTouch.OnMoveOperation += this.CandyTouch_OnMoveOperation;
            candyEntity.AddComponent(candyTouch)
            .AddComponent(candyAttributes)
            .AddComponent(new CandyAnimationBehavior());
            this.Owner.AddChild(candyEntity);

            this.candyCounter++;

            this.currentCandies.Add(candyAttributes);

            return(candyAttributes);
        }