Example #1
0
        public List <GameObjectBlueprint> getBuilds()
        {
            List <GameObjectBlueprint> ret = new List <GameObjectBlueprint>();

            foreach (GameObjectBlueprint blueprint in GameObjectFactory.Factory.GetBlueprintsWithTag("acegiak_Buildable"))
            {
                if (ExplodeNeeds(blueprint.GetTag("acegiak_Buildable")).ContainsKey(ParentObject.GetBlueprint().Name))
                {
                    ret.Add(blueprint);
                }
            }
            return(ret);
        }
Example #2
0
        //
        // Methods
        //
        public override bool FireEvent(Event E)
        {
            if (E.ID == "EnteredCell")
            {
                if (this.bCreated)
                {
                    return(true);
                }
                this.bCreated = true;

                Physics     physics  = this.ParentObject.GetPart("Physics") as Physics;
                List <Cell> cellList = new List <Cell>();
                physics.CurrentCell.GetAdjacentCells(4, cellList, true);
                List <Cell> emptyCellList = new List <Cell>();
                foreach (Cell current in cellList)
                {
                    if (current.IsEmpty())
                    {
                        emptyCellList.Add(current);
                    }
                }
                string        ParentBlueprint = ParentObject.GetBlueprint().Inherits;
                List <string> randomDogs      = new List <string>();
                int           dogs            = Stat.Random(2, 5);
                if (ParentObject.DisplayName.Contains("Loving") ||
                    ParentObject.DisplayName.Contains("Caring") ||
                    ParentObject.DisplayName.Contains("Loyal"))
                {
                    dogs += 5;
                }
                for (int i = 0; i < dogs; i++)
                {
                    randomDogs.Add(ParentBlueprint);
                }
                int dogIterator = 0;
                while (dogIterator < randomDogs.Count && emptyCellList.Count > 0)
                {
                    GameObject gameObject = GameObjectFactory.Factory.CreateObject(randomDogs[dogIterator]);
                    gameObject.GetPart <Brain>().PartyLeader = this.ParentObject;
                    Cell randomElement = emptyCellList.GetRandomElement(null);
                    randomElement.AddObject(gameObject);
                    XRLCore.Core.Game.ActionManager.AddActiveObject(gameObject);
                    emptyCellList.Remove(randomElement);
                    dogIterator++;
                }

                return(true);
            }
            return(true);
        }
        public GameObject CreateSeed()
        {
            if (Seed != null)
            {
                return(GameObject.create(Seed));
            }
            GameObject   seed     = GameObject.create("Seed");
            acegiak_Seed seedpart = seed.GetPart <acegiak_Seed>();

            seedpart.Result          = ParentObject.GetBlueprint().Name;
            seedpart.ResultName      = ParentObject.GetBlueprint().DisplayName().Replace(" Tree", "");
            seedpart.displayname     = "seed";
            seedpart.description     = "A seed from " + ParentObject.a + ParentObject.DisplayNameOnly + ".";
            seed.pRender.DisplayName = seedpart.ResultName + " " + seedpart.displayname;
            seed.pRender.ColorString = ParentObject.pRender.ColorString;
            seed.pRender.TileColor   = ParentObject.pRender.TileColor;
            seed.pRender.DetailColor = ParentObject.pRender.DetailColor;
            return(seed);
        }