Example #1
0
        void Update()
        {
            if (PauseMenu_HTML.IsPaused)
            {
                return;
            }

            if (GroupUtil.IsNeutral(Group))
            {
                return;
            }

            if (SoloEvolution)
            {
                UnitEvolution.Update(this);
            }

            if (!GroupUtil.isCreatureGroup(Group))
            {
                return;
            }

            ItemMain.Update(this);
            UnitEvolution.Update(this);
        }
Example #2
0
        public GameItem SetupItem(GameEntity ent, string name, Vector3Int pos, Player owner)
        {
            var index = Loader.GetIndexByName(name);
            var npc   = LuaNpcGetter.GetNpcById(index);

            ent.Owner        = owner;
            ent.OriginalName = name;
            ent.name         = name;
            var item = ent as GameItem;

            var evoTo = LuaNpcGetter.GetEvolutionTo(npc);

            if (evoTo.Length > 0)
            {
                if (!UnitEvolution.IsHasSoloEvolution(name))
                {
                    UnitEvolution.AddToSoloDict(name, evoTo);
                }

                if (item != null)
                {
                    item.SoloEvolution = true;
                }
            }

            var evoCross = LuaNpcGetter.GetNpcEvoCrossing(npc);

            if (evoCross.Keys.Count > 0)
            {
                foreach (var pair in evoCross)
                {
                    UnitEvolution.AddToStackDict(name, pair.Key, pair.Value);

                    if (!string.Equals(pair.Key, name, StringComparison.OrdinalIgnoreCase))
                    {
                        UnitEvolution.AddToStackDict(pair.Key, name, pair.Value);
                    }
                }
            }
            if (GroupUtil.IsItem(ent.Group))
            {
                SecondaryGroundLvL.SetGroundEnt(ChunkNumber, pos, item);
            }

            if (GroupUtil.isBuilding(ent.Group))
            {
                ChunkManager.AddVision(ent);
            }
            ItemEvents.OnCreateItem(item, firstCreate);

            Coloring.RecolorObject(ChunkUtil.GetDovvner(ent.CurrentPos));

            return(item);
        }
Example #3
0
        public GameUnit SetupUnit(GameEntity ent, string name, Vector3Int pos, Player owner)
        {
            var index = Loader.GetIndexByName(name);
            var npc   = LuaNpcGetter.GetNpcById(index);

            ent.Owner        = owner;
            ent.OriginalName = name;
            ent.name         = name;
            var unit = ent as GameUnit;

            var evoTo = LuaNpcGetter.GetEvolutionTo(npc);

            if (evoTo.Length > 0)
            {
                if (!UnitEvolution.IsHasSoloEvolution(name))
                {
                    UnitEvolution.AddToSoloDict(name, evoTo);
                }

                if (unit != null)
                {
                    unit.SoloEvolution = true;
                }
            }

            var evoCross = LuaNpcGetter.GetNpcEvoCrossing(npc);

            if (evoCross.Keys.Count > 0)
            {
                foreach (var pair in evoCross)
                {
                    UnitEvolution.AddToStackDict(name, pair.Key, pair.Value);

                    if (!string.Equals(pair.Key, name, StringComparison.OrdinalIgnoreCase))
                    {
                        UnitEvolution.AddToStackDict(pair.Key, name, pair.Value);
                    }
                }
            }

            ChunkManager.AddVision(ent);
            UnitEvents.OnUnitSpawned(unit);


            Coloring.RecolorObject(ChunkUtil.GetDovvner(ent.CurrentPos));

            return(unit);
        }
Example #4
0
        public virtual bool IsTimeForEvoCrossing(GameUnit unit)
        {
            var groupEnts = CreatureGroupManager.GetAllInGroup(unit.Group);

            foreach (var entInGroup in groupEnts)
            {
                if (unit == entInGroup)
                {
                    continue;
                }
                if (UnitEvolution.IsCanBeStacked(unit.OriginalName, entInGroup.OriginalName))
                {
                    return(true);
                }
            }
            return(false);
        }
Example #5
0
        void Update()
        {
            if (PauseMenu_HTML.IsPaused)
            {
                return;
            }

            if (SoloEvolution)
            {
                UnitEvolution.Update(this);
            }

            if (GroupUtil.IsNeutral(Group))
            {
                return;
            }
            AbilitiesManager.UpdateUnitAbilities(this);
        }