Ejemplo n.º 1
0
        public void BringToHome()
        {
            Defrag();

            for (int i = 0; i < m_Plants.Count; ++i)
            {
                object o = m_Plants[i];

                if (o is BasePlant)
                {
                    BasePlant plant = (BasePlant)o;

                    plant.MoveToWorld(Location, Map);
                }
            }
        }
Ejemplo n.º 2
0
        public void Spawn()
        {
            Map map = Map;

            if (map == null || map == Map.Internal || Parent != null)
            {
                return;
            }

            Defrag();

            if (m_Plants.Count >= m_Count)
            {
                return;
            }

            if (CanSpawn())
            {
                try
                {
                    int season = Map.Felucca.Season;

                    if (season < 0 || season > 3)
                    {
                        return;
                    }

                    if (season == 0 || season == 1 || season == 2)
                    {
                        season = Utility.Random(3);
                    }

                    if (m_Plant[season] == PlantType.None)
                    {
                        return;
                    }

                    Type   type = ScriptCompiler.FindTypeByName(m_Plant[season].ToString());
                    object o    = Activator.CreateInstance(type);

                    if (o is BasePlant)
                    {
                        BasePlant plant = (BasePlant)o;

                        m_Plants.Add(plant);

                        Point3D loc = GetSpawnPosition();

                        if (loc != Point3D.Zero)
                        {
                            plant.OnBeforeSpawn(loc, map);

                            plant.MoveToWorld(loc, map);

                            plant.OnAfterSpawn();
                        }
                    }
                }
                catch
                {
                }
            }
        }