Exemplo n.º 1
0
 void MakeUpgrade(ref CannonInfo ci, int lv, CannonType next)
 {
     ci.upgrades.Add(new CannonInfo.Upgrade()
     {
         level = lv, next = next
     });
 }
Exemplo n.º 2
0
        private void InitCannonInfo()
        {
            MonoEffect effect = Singleton <EffectManager> .Instance.TriggerEntityEffectPatternReturnValue(this.config.PositionsEffect, base.entity.XZPosition, base.entity.transform.forward, Vector3.one, base.entity)[0];

            int num = Mathf.Min(this.config.DelayList.Length, effect.transform.childCount);

            for (int i = 0; i < num; i++)
            {
                CannonInfo item = new CannonInfo {
                    localPosition = effect.transform.GetChild(i).localPosition
                };
                this._cannonList.Add(item);
            }
            if (< > f__am$cache7 == null)
            {
Exemplo n.º 3
0
    public void Reset()
    {
        points = 0;
        MaxHP  = HP = 100;
        day    = 0;

        cInfo[0] = new CannonInfo()
        {
            level = 1, _type = GameData.CannonType.Normal
        };
        cInfo[1] = new CannonInfo()
        {
            level = 1, _type = GameData.CannonType.Normal
        };
        cInfo[2] = new CannonInfo()
        {
            level = 1, _type = GameData.CannonType.Normal
        };
    }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShopPiece"/> class.
        /// </summary>
        /// <param name="info">The displayed information.</param>
        /// <param name="position">The position.</param>
        /// <param name="price">The price.</param>
        public ShopPiece(CannonInfo info, Vector2 position, int price)
        {
            //save the price and info to a member variable
            this.price = price;
            rewardInfo = info;

            //load the background image and rectangle
            slot    = Tools.Content.Load <Texture2D>("Images/Sprites/UI/Inventory Cell");
            slotBox = new Rectangle((int)position.X, (int)position.Y, (int)Dimensions.X, (int)Dimensions.Y);

            //create the buy button
            var buttonImg = Tools.Content.Load <Texture2D>("Images/Sprites/UI/Button BG shadow");

            buyBtn = new Button(buttonImg, new Rectangle(slotBox.Left + 5, slotBox.Bottom - 50, slotBox.Width - 15, 35), "$" + price);

            //if the price is initally zero then the item is initally active
            if (price == 0)
            {
                //change the text on the button to "ACTIVE"
                buyBtn.ChangeText("ACTIVE");
            }
        }
Exemplo n.º 5
0
    void MakeCannonInfo()
    {
        var ci = new CannonInfo();

        ci.maxLevel = 5;
        ci.info     = new CannonInfo.Level[5];
        MakeLevel(ref ci.info[0], 0, 3, 2.5f, 8.0f, 10.0f);
        MakeLevel(ref ci.info[1], 1, 3, 2.6f, 9.0f, 11.0f);
        MakeLevel(ref ci.info[2], 2, 4, 2.7f, 9.0f, 12.0f);
        MakeLevel(ref ci.info[3], 3, 4, 2.8f, 10.0f, 13.0f);
        MakeLevel(ref ci.info[4], 4, 5, 2.9f, 10.0f, 13.0f);

        MakeUpgrade(ref ci, 5, CannonType.Fast);
        MakeUpgrade(ref ci, 5, CannonType.Heavy);
        MakeUpgrade(ref ci, 5, CannonType.DoubleShot);

        cannonInfo[CannonType.Normal] = ci;

        ci          = new CannonInfo();
        ci.maxLevel = 5;
        ci.info     = new CannonInfo.Level[5];
        MakeLevel(ref ci.info[0], 0, 2, 4.5f, 7.0f, 12.0f);
        MakeLevel(ref ci.info[1], 2, 2, 4.7f, 7.0f, 12.0f);
        MakeLevel(ref ci.info[2], 3, 2, 4.9f, 7.0f, 12.0f);
        MakeLevel(ref ci.info[3], 4, 2, 5.1f, 9.0f, 14.0f);
        MakeLevel(ref ci.info[4], 5, 2, 5.3f, 9.0f, 14.0f);

        MakeUpgrade(ref ci, 5, CannonType.SuperFast);
        MakeUpgrade(ref ci, 5, CannonType.Cluster);

        cannonInfo[CannonType.Fast] = ci;

        ci          = new CannonInfo();
        ci.maxLevel = 5;
        ci.info     = new CannonInfo.Level[5];
        MakeLevel(ref ci.info[0], 0, 10, 1.5f, 15.0f, 18.0f);
        MakeLevel(ref ci.info[1], 2, 12, 1.5f, 16.0f, 18.0f);
        MakeLevel(ref ci.info[2], 3, 14, 1.5f, 17.0f, 18.0f);
        MakeLevel(ref ci.info[3], 4, 16, 1.5f, 18.0f, 18.0f);
        MakeLevel(ref ci.info[4], 5, 18, 1.5f, 19.0f, 18.0f);

        MakeUpgrade(ref ci, 5, CannonType.HeavyFast);
        MakeUpgrade(ref ci, 5, CannonType.Nuke);

        cannonInfo[CannonType.Heavy] = ci;

        ci          = new CannonInfo();
        ci.maxLevel = 5;
        ci.info     = new CannonInfo.Level[5];
        MakeLevel(ref ci.info[0], 0, 4, 2.5f, 10.0f, 10.0f);
        MakeLevel(ref ci.info[1], 2, 4, 2.7f, 10.0f, 10.0f);
        MakeLevel(ref ci.info[2], 3, 4, 2.9f, 10.0f, 10.0f);
        MakeLevel(ref ci.info[3], 4, 5, 2.9f, 10.0f, 10.0f);
        MakeLevel(ref ci.info[4], 5, 6, 2.9f, 10.0f, 10.0f);

        MakeUpgrade(ref ci, 5, CannonType.TripleShot);
        MakeUpgrade(ref ci, 5, CannonType.DoubleCluster);

        cannonInfo[CannonType.DoubleShot] = ci;

        ci          = new CannonInfo();
        ci.maxLevel = 1;
        ci.info     = new CannonInfo.Level[1];
        MakeLevel(ref ci.info[0], 0, 4, 8.0f, 10.0f, 10.0f);

        cannonInfo[CannonType.SuperFast] = ci;

        ci          = new CannonInfo();
        ci.maxLevel = 1;
        ci.info     = new CannonInfo.Level[1];
        MakeLevel(ref ci.info[0], 0, 2, 4.0f, 10.0f, 10.0f);

        cannonInfo[CannonType.Cluster] = ci;

        ci          = new CannonInfo();
        ci.maxLevel = 1;
        ci.info     = new CannonInfo.Level[1];
        MakeLevel(ref ci.info[0], 0, 15, 3.5f, 15.0f, 20.0f);

        cannonInfo[CannonType.HeavyFast] = ci;

        ci          = new CannonInfo();
        ci.maxLevel = 1;
        ci.info     = new CannonInfo.Level[1];
        MakeLevel(ref ci.info[0], 0, 20, 1.0f, 20.0f, 10.0f);

        cannonInfo[CannonType.Nuke] = ci;

        ci          = new CannonInfo();
        ci.maxLevel = 1;
        ci.info     = new CannonInfo.Level[1];
        MakeLevel(ref ci.info[0], 0, 6, 3.5f, 10.0f, 10.0f);

        cannonInfo[CannonType.TripleShot] = ci;

        ci          = new CannonInfo();
        ci.maxLevel = 1;
        ci.info     = new CannonInfo.Level[1];
        MakeLevel(ref ci.info[0], 0, 3, 4.0f, 10.0f, 10.0f);

        cannonInfo[CannonType.DoubleCluster] = ci;
    }
Exemplo n.º 6
0
        public override void Core()
        {
            base.Core();
            this._Timer += Time.deltaTime * base.entity.TimeScale;
            if (this._state != ArsenalState.None)
            {
                if (this._state == ArsenalState.Charge)
                {
                    if (this._chargeIndex < this._cannonList.Count)
                    {
                        CannonInfo cannon = this._cannonList[this._chargeIndex];
                        if (this._Timer >= cannon.delay)
                        {
                            Vector3 initDir = (Vector3)(Quaternion.FromToRotation(Vector3.forward, base.entity.transform.forward) * cannon.localForward);
                            Vector3 initPos = base.entity.XZPosition + (Quaternion.FromToRotation(Vector3.forward, base.entity.transform.forward) * cannon.localPosition);
                            cannon.position      = initPos;
                            cannon.forward       = initDir.normalized;
                            cannon.cannonEffects = Singleton <EffectManager> .Instance.TriggerEntityEffectPatternReturnValue(this.config.CannonEffects, initPos, initDir, Vector3.one, base.entity);

                            this.UpdateEffects(cannon.cannonEffects, initPos, initDir);
                            cannon.chargeEffects = Singleton <EffectManager> .Instance.TriggerEntityEffectPatternReturnValue(this.config.ChargeEffects, initPos, initDir, Vector3.one, base.entity);

                            this.UpdateEffects(cannon.chargeEffects, initPos, initDir);
                            Singleton <EffectManager> .Instance.TriggerEntityEffectPatternReturnValue(this.config.HintEffects, this.GetTargetPosition(cannon), Vector3.forward, Vector3.one, base.entity);

                            this._chargeIndex++;
                        }
                    }
                    if (this._Timer > this.config.ChargeTime)
                    {
                        this._state      = ArsenalState.Fire;
                        this._Timer      = 0f;
                        this._shakeTimer = this.config.FireIntervial;
                    }
                }
                else if (this._state == ArsenalState.Fire)
                {
                    for (int i = 0; i < this._cannonList.Count; i++)
                    {
                        CannonInfo info2 = this._cannonList[i];
                        info2.fireTimer -= Time.deltaTime * base.entity.TimeScale;
                        if (info2.fireTimer <= 0f)
                        {
                            List <MonoEffect> list = Singleton <EffectManager> .Instance.TriggerEntityEffectPatternReturnValue(this.config.ShootEffects, info2.position, info2.forward, Vector3.one, base.entity);

                            this.UpdateEffects(list, info2.position, info2.forward);
                            Vector2 vector3 = (Vector2)(UnityEngine.Random.insideUnitCircle * this.config.ExplodeRadius);
                            Vector3 vector4 = new Vector3(vector3.x, 0f, vector3.y);
                            Singleton <EffectManager> .Instance.TriggerEntityEffectPatternReturnValue(this.config.ExplodeEffects, this.GetTargetPosition(info2) + vector4, Vector3.forward, Vector3.one, base.entity);

                            this.CreateExplode(this.GetTargetPosition(info2));
                            info2.fireTimer = this.config.FireIntervial;
                        }
                    }
                    this._shakeTimer -= Time.deltaTime * base.entity.TimeScale;
                    if (this._shakeTimer <= 0f)
                    {
                        ConfigMonsterAnimEvent event2 = SharedAnimEventData.ResolveAnimEvent(this._monster.config, this.config.ShakeAnimEventID);
                        if (event2.CameraShake != null)
                        {
                            AttackPattern.ActCameraShake(event2.CameraShake);
                        }
                        this._shakeTimer = this.config.FireIntervial;
                    }
                    if (this._Timer > this.config.FireTime)
                    {
                        this._state = ArsenalState.Disappear;
                        this._Timer = 0f;
                    }
                }
                else if (this._Timer > this.config.ClearTime)
                {
                    this._state = ArsenalState.None;
                    this.ClearCannons();
                }
            }
        }
Exemplo n.º 7
0
        private Vector3 GetTargetPosition(CannonInfo cannon)
        {
            float num = Mathf.Abs((float)(cannon.position.y / cannon.forward.y));

            return(cannon.position + ((Vector3)(cannon.forward * num)));
        }