Beispiel #1
0
        private void ExitCottage(object sender, IncomingMessage receivedMessage)
        {
            Entity cottage = networkedScene.EntityManager.Find(receivedMessage.ReadString());

            if (cottage != null && !cottage.IsDisposed)
            {
                Cottage cot    = cottage.FindComponent <Cottage>();
                int     number = receivedMessage.ReadInt32();
                if (cot != null && !cot.UnderConstruction())
                {
                    LayerTile aux = Map.map.GetTileByMapCoordinates(receivedMessage.ReadInt32(), receivedMessage.ReadInt32());
                    cot.ExitPerson(number, aux);
                }
            }
        }
        public bool CanAct(WorldObject other)
        {
            bool res = other != null && !other.IsDestroyed();

            if (res)
            {
                Cottage   cottage = other.Owner.FindComponent <Cottage>();
                LayerTile l1      = Map.map.GetTileByWorldPosition(cottage.wo.GetCenteredPosition());
                LayerTile l2      = Map.map.GetTileByWorldPosition(wo.GetCenteredPosition());

                res = !cottage.UnderConstruction() &&
                      cottage.GetCount() < cottage.maxOccupation && !cottage.GetPeople().Contains(wo) &&
                      wo.player == cottage.wo.player && Map.map.Adjacent(l1, l2) &&
                      (wo.GetAction() == ActionEnum.Exit || wo.GetAction() == ActionEnum.Idle);
            }
            return(res);
        }