Beispiel #1
0
        public override void Reset(AbCellData data)
        {
            base.Reset(data);

            this.Data = data as EnviromentCellData;

            UpdateInfo();
        }
Beispiel #2
0
        private AbCellData CreateNewCellData(Vector3Int pos)
        {
            AbCellData res;

            if (NestPositions.ContainsValue(pos))
            {
                res = new NestCellData();
            }
            else
            {
                //todo: randomize this cell
                var env = new EnviromentCellData();
                if (Random.Range(0, 100) < config.ResourceChance)
                {
                    if (Random.Range(0, 100) < 70)
                    {
                        if (Random.Range(0, 100) < 30)
                        {
                            env.Source = new CellSource(SourceTypes.SolidFruit, 2 * config.ResourceQuality + Random.Range(-config.ResourceQuality, config.ResourceQuality));
                        }
                        else
                        {
                            env.Source = new CellSource(SourceTypes.FlimsyFruit, config.ResourceQuality + Random.Range(-config.ResourceQuality / 2, config.ResourceQuality / 2));
                        }
                    }
                    else
                    {
                        if (Random.Range(0, 100) < 30)
                        {
                            env.Source = new CellSource(SourceTypes.SolidMeat, 2 * config.ResourceQuality + Random.Range(-config.ResourceQuality, config.ResourceQuality));
                        }
                        else
                        {
                            env.Source = new CellSource(SourceTypes.FlimsyMeat, config.ResourceQuality + Random.Range(-config.ResourceQuality / 2, config.ResourceQuality / 2));
                        }
                    }
                }
                if (Random.Range(0, 100) < config.BugChance)
                {
                    env.Bug      = BugTypes.Caterpillar;
                    env.BugCount = pos.magnitude < 4 ? config.BugStrength * 1 : pos.magnitude < 8 ? config.BugStrength * 2 : config.BugStrength * 3;
                }
                res = env;
            }
            res.FieldPosition = pos;
            return(res);
        }