예제 #1
0
    protected override IEnumerator SpawningRoutine()
    {
        WaitForSeconds waitOneSec = new WaitForSeconds(1f);

        while (true)
        {
            if (isSpwaningDuringThisLevel)
            {
                yield return(new WaitForSeconds(Random.Range(levelSettings.mineMinWait, levelSettings.mineMaxWait)));

                MineType type = (Random.value > .5f) ? MineType.Blue : MineType.Red;
                SpawnMine(type, levelSettings.mineMinSize, levelSettings.mineMaxSize, levelSettings.mineMinSpeed, levelSettings.mineMaxSpeed);
                if (transform.position.y >= 800)
                {
                    SpawnMine(type, levelSettings.mineMinSize, levelSettings.mineMaxSize, levelSettings.mineMinSpeed, levelSettings.mineMaxSpeed);
                }
                if (transform.position.y >= 1600)
                {
                    SpawnMine(type, levelSettings.mineMinSize, levelSettings.mineMaxSize, levelSettings.mineMinSpeed, levelSettings.mineMaxSpeed);
                }
                if (transform.position.y >= 2500)
                {
                    SpawnMine(type, levelSettings.mineMinSize, levelSettings.mineMaxSize, levelSettings.mineMinSpeed, levelSettings.mineMaxSpeed);
                }
            }
            else
            {
                yield return(waitOneSec);
            }
        }
    }
예제 #2
0
    public void FlashGatherTimes(MineType mt)
    {
        _BuyTimes.Hide();
        _mineType = mt;

        _Gather.Show();
    }
예제 #3
0
 public static Mine Create
 (
     MineType t, int ind
 )
 {
     return(new Mine(
                GameState.Resourses[t.MiningResourseId],
                t.MineRate,
                t.DamageRate,
                t.StrengthMultipler,
                t.EnduranceMultipler,
                t.OccupyingSpace,
                new UnitHolder(
                    "UnitHolder",
                    t.MaxUnitsOccupyingSpace,
                    0,
                    new List <Unit>()
                    ),
                $"Mine " + ind.ToString("D3"),
                State.Destroyed,
                t.TimeToBuildSec,
                t.TimeToDestroySec,
                t.NecessaryResourses
                ));
 }
예제 #4
0
        private Mine AddMine(Vector2 position, MineType wantedType = MineType.Random)
        {
            bool isBigMine = false;

            if (wantedType == MineType.Big)
            {
                isBigMine = true;
            }
            else if (wantedType == MineType.Random)
            {
                isBigMine = _rnd.Next(4) == 0;
            }


            Vector2  movement = new Vector2((float)_rnd.NextDouble() * .3f - .15f, (float)_rnd.NextDouble() * .2f + 0.1f);
            MineType type     = isBigMine ? MineType.Big : MineType.Small;

            Mine mine = new Mine(Game, position, _spritebatch, type, 1, 1, (float)_rnd.NextDouble(), (float)(0.005f * _rnd.NextDouble() + 0.003f) * (_rnd.Next(2) == 0 ? 1 : -1));

            if (isBigMine)
            {
                movement /= 2;
            }
            mine.Movement = movement;
            _mines.Add(mine);
            return(mine);
        }
예제 #5
0
    public Ore(OreTypes ore, int amount)
    {
        this.type   = ore;
        this.amount = amount;

        switch (ore)
        {
        case OreTypes.Coal: {
            mine = MineType.Shaft;
            break;
        }

        case OreTypes.Iron: {
            mine = MineType.Shaft;
            break;
        }

        case OreTypes.Copper: {
            mine = MineType.Shaft;
            break;
        }

        case OreTypes.Wood: {
            mine = MineType.Mill;
            break;
        }
        }
    }
예제 #6
0
 public BuildingType(String name, Component script, Sprite sprite, Dictionary <OreTypes, int> costs, KeyCode hotkey, MineType type = MineType.None)
 {
     this.name   = name;
     this.script = script;
     this.sprite = sprite;
     this.costs  = costs;
     this.hotkey = hotkey;
     this.type   = type;
 }
예제 #7
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     ExplosionPressure = valuesDictionary.GetValue("ExplosionPressure", 60f);
     MineType          = valuesDictionary.GetValue <MineType>("Type", 0);
     Delay             = valuesDictionary.GetValue("Delay", .0);
     (ComponentBody = Entity.FindComponent <ComponentBody>(true)).CollidedWithBody += CollidedWithBody;
     if ((MineType & MineType.Torpedo) != 0)
     {
         ComponentBody.Density = .8f;
     }
 }
예제 #8
0
파일: Mine.cs 프로젝트: AtwoodDeng/GGJ2019
        virtual public void Collect(Catcher catcher)
        {
            //transform.parent = catcher.transform;
            transform.localScale = Vector3.zero;
            type = MineType.Dead;
            var collider = gameObject.GetComponent <Collider2D>();

            if (collider != null)
            {
                collider.enabled = false;
            }
            // gameObject.active = false;
        }
예제 #9
0
    IEnumerator SpawnMines()
    {
        int i = 0;

        while (i < 10)
        {
            yield return(wait);

            MineType color = (i < 4) ? MineType.Blue : MineType.Red;
            mineSpawner.SpawnMine(color, 1f, 1f, .5f, .5f);
            i++;
        }
        NextState();
    }
예제 #10
0
        public static void ClickEnterMine(MineType type)
        {
            //进入我的
            if (Application.isEditor)
            {
                return;
            }

            var mEventId = $"Click_Enter_Mine";
            var extras   = new Dictionary <string, string>();

            extras.Add("type", type.ToString());
            JAnalyticsPlugin.CountEvent(mEventId, extras);
        }
예제 #11
0
        private static void AddSingleBuildingType(Queue <string> args)
        {
            Building.Type type;

            switch (args.Dequeue())
            {
            case "HOUSE":
                type = Building.Type.House;
                break;

            case "MINE":
                type = Building.Type.Mine;
                break;

            case "FACTORY":
                type = Building.Type.Factory;
                break;

            default:
                throw new Exception("Incorrect BuildingType Init");
            }

            switch (type)
            {
            case Building.Type.House:
                BuildingTypes.Add(
                    HouseType.Create(args, ReadNecessaryResourses(args))
                    );
                break;

            case Building.Type.Mine:
                BuildingTypes.Add(
                    MineType.Create(args, ReadNecessaryResourses(args))
                    );
                break;

            case Building.Type.Factory:
                BuildingTypes.Add(
                    FactoryType.Create(args, ReadNecessaryResourses(args))
                    );
                break;

            default:
                throw new Exception("Incorrect BuildingType Init");
            }
        }
예제 #12
0
        /// <summary>
        /// Method that returns a given mine based on the input type.
        /// </summary>
        /// <param name="type">Mine type parameter.</param>
        /// <returns>Returns a Mine object based on the input type.</returns>
        public Mine GetMine(MineType type)
        {
            switch (type)
            {
                case MineType.MineOne:
                    return this.levelOne;
                case MineType.MineTwo:
                    return this.levelTwo;
                case MineType.MineThree:
                    return this.levelThree;
                case MineType.MineFour:
                    return this.levelFour;
                case MineType.MineFive:
                    return this.levelFive;
            }

            return null;
        }
예제 #13
0
 public IMine CreateMine(MineType type)
 {
     switch (type)
     {
         case MineType.Mini:
             return new MiniMine();
         case MineType.Double:
             return new DoubleMine();
         case MineType.Average:
             return new AverageMine();
         case MineType.Big:
             return new BigMine();
         case MineType.Huge:
             return new HugeMine();
         default:
             throw new InvalidOperationException("The mine type specified is invalid.");
     }
 }
예제 #14
0
파일: Gunpowder.cs 프로젝트: Lixue9jiu/SCIE
        public Mine(MineType type = MineType.Medium, double delay = 0, string description = "Mine") : base("Models/Snowball", "Snowball", Matrix.CreateTranslation(Vector3.Zero), Matrix.CreateTranslation(Vector3.Zero) * Matrix.CreateScale(20f), (type & MineType.Incendiary) != 0 ? Color.DarkRed : Color.LightGray, 2.5f)
        {
            DefaultDescription = description;
            switch (MineType & MineType.Large)
            {
            case MineType.Tiny: ExplosionPressure = 50f; break;

            case MineType.Small: ExplosionPressure = 80f; break;

            case MineType.Medium: ExplosionPressure = 120f; break;

            case MineType.Large: ExplosionPressure = 300f; break;
            }
            if ((type & MineType.Incendiary) != 0)
            {
                ExplosionPressure *= 0.9f;
            }
            Delay    = delay;
            MineType = type;
        }
예제 #15
0
    public GameObject SpawnMine(MineType type, float minScale, float maxScale, float minSpeed, float maxSpeed)
    {
        // Position
        Vector3 pos = transform.position;

        pos.x = Random.Range(minPosX, maxPosX);

        // Init
        GameObject mine;

        if (type == MineType.Blue)
        {
            mine = Instantiate(blueMinePrefab, pos, Quaternion.identity);
        }
        else
        {
            mine = Instantiate(redMinePrefab, pos, Quaternion.identity);
        }
        MineController mineCtrlr = mine.GetComponent <MineController>();

        mineCtrlr.explosionVFX        = explosionVFX;
        mineCtrlr.explosionSoundCtrlr = explosionSoundCtrlr;

        // Rotation
        mine.transform.localRotation = Random.rotation;

        // Size
        Vector3 scale = mine.transform.localScale;

        scale *= Random.Range(minScale, maxScale);
        mine.transform.localScale = scale;

        // Speed
        Rigidbody2D rb = mine.GetComponent <Rigidbody2D>();

        rb.gravityScale *= Random.Range(minSpeed, maxSpeed);

        return(mine);
    }
        public void OnAddBuildingToPlanetColony(Colony c, BuildingType bt)
        {
            if (c == null || bt == null)
            {
                return;
            }

            switch (bt.Type)
            {
            case Building.Type.House:
                HouseType ht = (HouseType)bt;

                c.Add(
                    House.Create(ht, c.Buildings.Sum(x => x.BuildingType == Building.Type.House ? 1 : 0))
                    );

                break;

            case Building.Type.Mine:
                MineType mt = (MineType)bt;

                c.Add(
                    Mine.Create(mt, c.Buildings.Sum(x => x.BuildingType == Building.Type.Mine ? 1 : 0))
                    );

                break;

            case Building.Type.Factory:
                FactoryType ft = (FactoryType)bt;

                c.Add(
                    Factory.Create(ft, c.Buildings.Sum(x => x.BuildingType == Building.Type.Factory ? 1 : 0))
                    );

                break;
            }
        }
예제 #17
0
        private void AddMeteor(MineType type = MineType.Random)
        {
            Vector2 position = new Vector2((float)_rnd.NextDouble() * (_graphics.PreferredBackBufferWidth * .6f) + (_graphics.PreferredBackBufferWidth * .2f), -100);

            AddMine(position, type);
        }
예제 #18
0
 public Mine(double gravity, MineType mineType)
 {
     Gravity = gravity;
     Type    = mineType;
 }
예제 #19
0
    public int GetGatherMoneyByType(MineType mt)
    {
        List <GatherData> tmp = GatherData.GetGatherList(mt);

        return(tmp[0]._Money);
    }
예제 #20
0
 public static List <GatherData> GetGatherList(MineType type)
 {
     return(_Meta[(int)type]);
 }
예제 #21
0
        protected override void PreBuild()
        {
            base.PreBuild();
            if (base.Component.Url.HasValue())
            {
                base.Options["url"] = base.Component.Url;
            }
            if (base.Component.chunk_size.HasValue())
            {
                base.Options["chunk_size"] = base.Component.chunk_size;
            }
            if (base.Component.drop_element.HasValue())
            {
                base.Options["drop_element"] = base.Component.drop_element;
            }
            bool?nullable;

            if (base.Component.filters != null)
            {
                FileFilters   filters       = base.Component.filters;
                StringBuilder stringBuilder = new StringBuilder();
                if (filters.max_file_size.HasValue())
                {
                    stringBuilder.Append(",max_file_size:'" + filters.max_file_size + "'");
                }
                nullable = filters.prevent_duplicates;
                if (nullable.HasValue)
                {
                    StringBuilder stringBuilder2 = stringBuilder;
                    nullable = filters.prevent_duplicates;
                    stringBuilder2.Append(",prevent_duplicates:" + nullable.ToString().ToLower());
                }
                if (filters.mime_types.Any())
                {
                    stringBuilder.Append(",mime_types:[");
                    for (int i = 0; i < filters.mime_types.Count; i++)
                    {
                        MineType mineType = filters.mime_types[i];
                        stringBuilder.Append(((i > 0) ? "," : "") ?? "");
                        stringBuilder.Append("{title:'" + mineType.title + "',extensions:'" + mineType.extensions + "'}");
                    }
                    stringBuilder.Append("]");
                }
                stringBuilder.Append("}");
                stringBuilder.Remove(1, false).Insert(0, "{");
                base.Options["filters"] = stringBuilder;
            }
            if (base.Component.headers != null)
            {
                base.Options["headers"] = base.Component.headers;
            }
            if (base.Component.max_retries.HasValue)
            {
                base.Options["max_retries"] = base.Component.max_retries;
            }
            if (base.Component.multipart_params != null)
            {
                base.Options["multipart_params"] = base.Component.multipart_params;
            }
            nullable = base.Component.multi_selection;
            if (nullable.HasValue)
            {
                base.Options["multi_selection"] = base.Component.multi_selection;
            }
            if (base.Component.resize != null)
            {
                base.Options["resize"] = base.Component.resize;
            }
            nullable = base.Component.send_chunk_number;
            if (nullable.HasValue)
            {
                base.Options["send_chunk_number"] = base.Component.send_chunk_number;
            }
            nullable = base.Component.send_file_name;
            if (nullable.HasValue)
            {
                base.Options["send_file_name"] = base.Component.send_file_name;
            }
            nullable = base.Component.unique_names;
            if (nullable.HasValue)
            {
                base.Options["unique_names"] = base.Component.unique_names;
            }
            nullable = base.Component.PicView;
            if (nullable.HasValue)
            {
                base.Options["picView"] = base.Component.PicView;
            }
            if (base.Component.PicWidth.HasValue)
            {
                base.Options["picWidth"] = base.Component.PicWidth;
            }
            if (base.Component.PicHeight.HasValue)
            {
                base.Options["picHeight"] = base.Component.PicHeight;
            }
            if (base.Component.Max.HasValue)
            {
                base.Options["max"] = base.Component.Max;
            }
            if (base.Component.OssBucket.HasValue())
            {
                base.Options["bucket"] = base.Component.OssBucket;
            }
            if (base.Component.Dir.HasValue())
            {
                base.Options["dir"] = base.Component.Dir;
            }
            nullable = base.Component.AutoUpload;
            if (nullable.HasValue)
            {
                base.Options["autoUpload"] = base.Component.AutoUpload;
            }
        }