Esempio n. 1
0
        public void TransferEntity(IChunk chunk)
        {
            if (/*CurrentChunk == chunk ||*/ chunk == null)
            {
                return;
            }

            CurrentChunk?.UnregisterEntity(this);
            chunk.RegisterEntity(this);

            ILogicEvent tempEvent;

            if (CurrentChunk == null || CurrentChunk.Map != chunk.Map)
            {
                tempEvent = new EntityChangesMap
                {
                    FromHere = CurrentChunk,
                    ToHere   = chunk
                };
            }
            else
            {
                tempEvent = new EntityTransferBetweenChunks
                {
                    FromHere = CurrentChunk,
                    ToHere   = chunk
                };
            }
            EmitEventAsync(tempEvent);

            CurrentChunk = chunk;
        }