Esempio n. 1
0
        public Entity CreateDroidEntity(CivilianTypeVO droidType, IntPosition position)
        {
            Entity         entity    = this.CreateWalkerBaseEntity(position, droidType.SizeX, droidType.SizeY);
            DroidComponent component = new DroidComponent();

            entity.Add(component);
            entity.Add(new CivilianComponent(droidType));
            Service.Get <EntityViewManager>().LoadEntityAsset(entity);
            return(entity);
        }
Esempio n. 2
0
        private Entity FindIdleDroid(CivilianTypeVO droidType)
        {
            Entity droidHut = this.GetDroidHut();
            NodeList <DroidNode> nodeList = Service.EntityController.GetNodeList <DroidNode>();

            for (DroidNode droidNode = nodeList.Head; droidNode != null; droidNode = droidNode.Next)
            {
                if (droidNode.Droid.Target == droidHut || droidNode.Droid.Target == null)
                {
                    return(droidNode.Entity);
                }
            }
            return(this.CreateDroid(droidType));
        }
Esempio n. 3
0
        private Entity CreateDroid(CivilianTypeVO droidType)
        {
            Entity droidHut = this.GetDroidHut();

            if (droidHut == null)
            {
                return(null);
            }
            TransformComponent transformComponent = droidHut.Get <TransformComponent>();
            IntPosition        position           = new IntPosition(transformComponent.X - 1, transformComponent.Z - 1);
            Entity             entity             = Service.EntityFactory.CreateDroidEntity(droidType, position);
            BoardItemComponent boardItemComponent = entity.Get <BoardItemComponent>();

            Service.BoardController.Board.AddChild(boardItemComponent.BoardItem, position.x, position.z, null, false);
            Service.EntityController.AddEntity(entity);
            return(entity);
        }
Esempio n. 4
0
        private void AssignWorkToDroid(Entity building, bool hasScaffolding, bool forceCreate, bool animateTravel)
        {
            CivilianTypeVO droidType = Service.StaticDataController.Get <CivilianTypeVO>(this.DROID_UID);
            Entity         entity    = (!forceCreate) ? this.FindIdleDroid(droidType) : this.CreateDroid(droidType);

            if (entity == null || building == null)
            {
                return;
            }
            BuildingComponent buildingComponent = building.Get <BuildingComponent>();

            if (buildingComponent == null || buildingComponent.BuildingType.Type == BuildingType.Wall)
            {
                return;
            }
            entity.Get <DroidComponent>().AnimateTravel = animateTravel;
            entity.Get <DroidComponent>().Target        = building;
        }
Esempio n. 5
0
 public CivilianComponent(CivilianTypeVO civilianType) : base(civilianType.AssetName, civilianType)
 {
     this.CivilianType = civilianType;
 }