public GameObject SpawnVirus(string virusName, VirusData data, Vector3 pos, bool isAdd)
    {
        //Debug.Log("***************virusName == " + virusName);
        var obj   = Pools.Spawn(virusName);
        var virus = obj.transform.GetComponent <BaseVirus>();

        if (!virusName.Equals("AdsorptionVirus"))
        {
            obj.transform.GetComponent <VirusSpriteSetter>().Set(_minOrderIndex);
            obj.GetComponent <BubbleEffectMrg>().Initi(_minOrderIndex, data.SplitLevel, data.VirusColorLevel);
            _minOrderIndex++;
        }
        else
        {
            obj.transform.GetComponent <VirusSpriteSetter>().Set(_maxOrderIndex);
            obj.GetComponent <BubbleEffectMrg>().Initi(_minOrderIndex, data.SplitLevel, data.VirusColorLevel);
            _maxOrderIndex--;
        }
        virus.Born(data);
        obj.transform.position = pos;
        if (isAdd)
        {
            var n = (VirusName)Enum.Parse(typeof(VirusName), virusName);
            _originCount += VirusTool.GetChildSplit(data.SplitLevel, n);
        }

        _virusObjects.Add(obj);
        return(obj);
    }
    public void MinusVirusCount(BaseVirus virus)
    {
        VirusName n     = (VirusName)Enum.Parse(typeof(VirusName), virus.name);
        int       count = VirusTool.GetSplit(virus.SplitLevel, n);

        _originCount -= count;
    }
Exemplo n.º 3
0
    public static int Load(int level)
    {
        _data      = new WaveVirusData();
        _nameRoll  = new ChanceRoll();
        _colorRoll = new ChanceRoll();
        WaveIndex  = 0;
        IsNextWave = true;
        int endValue = 0;

        if (level == 2 || level % 5 == 0)
        {
            _data.HasBoss = true;
            _curBossName  = GetBossVirusName(level);
        }

        FillCache(level);
        FillVirusNames(level);
        FillNameRoll();
        FillColorRoll(level);
        endValue = FillData();
        if (_data.HasBoss)
        {
            WaveVirusItem boss = new WaveVirusItem();
            boss.SplitLevel = SplitLevel.Level5;
            boss.ColorLevel = ColorLevel.Level0;
            boss.VirusName  = _curBossName;
            _data.Data[1].Insert(0, boss);
            endValue += VirusTool.GetChildSplit(SplitLevel.Level5, boss.VirusName);
        }
        return(endValue);
    }
Exemplo n.º 4
0
        private void UpgradeMainFire()
        {
            int needCoin = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetShootLevel());

            VirusGameDataAdapter.MinusTotalCoin(needCoin);
            VirusPlayerDataAdapter.AddShootPower(1);
        }
Exemplo n.º 5
0
        public void OnEvent(UIVirusAddLevelCoinEvent eventType)
        {
            var     rt   = transform as RectTransform;
            Vector2 pos  = VirusTool.SceneToUguiPos(rt, eventType.WorldPos);
            var     coin = PropPools.Instance.Spawn("Coin");

            coin.transform.SetParent(coinParent);
            var rectTransform = coin.transform as RectTransform;

            rectTransform.localScale = Vector3.one;
            if (rectTransform != null)
            {
                rectTransform.anchoredPosition = pos;
                Vector2 e   = _coinBg.anchoredPosition;
                Vector2 s   = pos;
                Vector2 dir = Quaternion.Euler(0, 0, -90) * (e - s).normalized;
                float   mul = Random.Range(0, 2) == 1 ? 1f : -1f;
                float   t1  = Random.Range(0.3f, 0.5f);
                Vector2 mid = Vector2.Lerp(s, e, t1) + mul * dir * Random.Range(1.0f, 2.0f) * 100f;
                float   dis = (e - s).magnitude;
                DOVirtual.Float(0, 10, dis / 1000f, (t) =>
                {
                    Vector2 p = VirusTool.GetBesselPoint(s, e, mid, t / 10f);
                    rectTransform.anchoredPosition = p;
                }).OnComplete(() =>
                {
                    PropPools.Instance.DeSpawn(coin);
                    _isLerp = true;
                    VirusSoundMrg.Instance.PlaySound(VirusSoundType.LevelCoin);
                });
            }
        }
Exemplo n.º 6
0
        private void UpgradeMainSpeed()
        {
            int needCoin = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetShootSpeed());

            VirusGameDataAdapter.MinusTotalCoin(needCoin);
            VirusPlayerDataAdapter.AddShootSpeed();
        }
Exemplo n.º 7
0
        private void SeekVirus()
        {
            List <float> angles      = VirusTool.GetRandomAngles(4, 30);
            var          targetVirus = VirusMrg.Instance.GetRandomVirus();

            for (int i = 0; i < _miniCanons.Count; i++)
            {
                var canon = _miniCanons[i];
                canon.Initi(targetVirus != null ? targetVirus.transform : null, angles[i]);
            }
        }
Exemplo n.º 8
0
 private void Update()
 {
     if (_isLerp)
     {
         int totalCoin = VirusGameDataAdapter.GetCurLevelCoin();
         _lastCoin = Mathf.Lerp(_lastCoin, totalCoin, Time.deltaTime * 5);
         if (Mathf.Abs(_lastCoin - totalCoin) < 0.1f)
         {
             _isLerp = false;
         }
         _coinText.text = VirusTool.GetStrByIntger(Mathf.CeilToInt(_lastCoin));
     }
 }
Exemplo n.º 9
0
        private void RefreshMainPanelUIInfo()
        {
            int fireNeedCoin  = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetShootLevel());
            int speedNeedCoin = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetShootSpeed());

            textMainFireLv.text    = $"[Lv{VirusPlayerDataAdapter.GetShootLevel()}]";
            textMainFireValue.text = $"{VirusPlayerDataAdapter.GetShootLevel()*10}";
            textMainFireCoin.text  = $"x{fireNeedCoin}";

            textMainSpeedLv.text    = $"[Lv{VirusPlayerDataAdapter.GetShootSpeed()}]";
            textMainSpeedValue.text = $"{VirusPlayerDataAdapter.GetShootSpeed()*10}";
            textMainSpeedCoin.text  = $"x{speedNeedCoin}";

            btnMainFire.interactable  = CheckCoin(fireNeedCoin);
            btnMainSpeed.interactable = CheckCoin(speedNeedCoin);
        }
Exemplo n.º 10
0
    private static int FillData()
    {
        List <WaveVirusItem> items = new List <WaveVirusItem>();

        foreach (var t1 in _data.Cache)
        {
            for (int i = 0; i < t1.Value; i++)
            {
                WaveVirusItem item      = new WaveVirusItem();
                int           nameIndex = _nameRoll.Roll();
                item.SplitLevel = t1.Key;
                item.VirusName  = _virusNames[nameIndex];
                item.ColorLevel = (ColorLevel)_colorRoll.Roll();
                items.Add(item);
            }
        }
        int count = items.Count;
        int t     = count / 2;

        items.Reshuffle();
        List <WaveVirusItem> list1 = new List <WaveVirusItem>();
        List <WaveVirusItem> list2 = new List <WaveVirusItem>();

        for (int i = 0; i < count; i++)
        {
            if (i < t - 1)
            {
                list1.Add(items[i]);
            }
            else
            {
                list2.Add(items[i]);
            }
        }
        _data.Data.Add(list1);
        _data.Data.Add(list2);
        int value = 0;

        for (int i = 0; i < items.Count; i++)
        {
            var item = items[i];
            value += VirusTool.GetChildSplit(item.SplitLevel, item.VirusName);
        }
        items.Clear();
        return(value);
    }
Exemplo n.º 11
0
        public override float StartCure(ICure icure, float healthValue)
        {
            if (Mathf.Abs(TotalHealth - VirusHealth.Value) > 0.1f)
            {
                _virusHealthAddEffect.StartHealthEffect(icure);
            }
            float vv         = base.StartCure(icure, healthValue);
            var   virusLevel = VirusTool.GetVirusColorLevel("VampireVirus", VirusGameDataAdapter.GetLevel(), VirusHealth.Value);

            if (virusLevel != CurColorLevel)
            {
                CurColorLevel = virusLevel;
                VirusSprite.Initi(CurColorLevel);
                transform.GetComponent <BubbleEffectMrg>().SetBubbleSprite(CurColorLevel);
            }
            return(vv);
        }
Exemplo n.º 12
0
        public override float StartCure(ICure iCure, float healthValue)
        {
            float vv         = base.StartCure(iCure, healthValue);
            var   virusLevel = VirusTool.GetVirusColorLevel("RegenerativeVirus", VirusGameDataAdapter.GetLevel(), VirusHealth.Value);

            if (virusLevel != CurColorLevel)
            {
                CurColorLevel = virusLevel;
                VirusSprite.Initi(CurColorLevel);
                transform.GetComponent <BubbleEffectMrg>().SetBubbleSprite(CurColorLevel);
            }
            if (Mathf.Abs(VirusHealth.Value - TotalHealth) < 0.1f)
            {
                _virusHealthAddEffect.StopHealthEffect(this);
            }
            return(vv);
        }
    public static void AddLevel()
    {
        //这里表示玩家已经通过当前关卡,需要对关卡信息进行存档
        if (IGamerProfile.Instance != null)
        {
            int index = _gameData.Level - 1;
            if (index < IGamerProfile.Instance.playerdata.levelProcess.Length)
            {
                //更新进度
                IGamerProfile.Instance.playerdata.levelProcess[index] = IGamerProfile.gameLevel.mapMaxLevel[index];
                IGamerProfile.Instance.SaveGamerProfileToServer();
            }

            if (_gameData.Level < IGamerProfile.Instance.playerdata.levelProcess.Length)
            {
                _gameData.Level++;
            }
            else
            {
                //已经到最大关卡了
            }
        }
        else
        {
            _gameData.Level++;
        }

        if (IGamerProfile.Instance != null)
        {
            int weaponLevel = VirusTool.UnlockViceWeapon(_gameData.Level);
            if (weaponLevel >= (int)UiSceneSelectGameCharacter.CharacterId.ChildWeapon01 &&
                weaponLevel <= (int)UiSceneSelectGameCharacter.CharacterId.ChildWeaponCount)
            {
                if (IGamerProfile.Instance.playerdata.characterData[weaponLevel].isactive == false)
                {
                    //解锁副武器
                    //标记当前角色解锁
                    IGamerProfile.Instance.playerdata.characterData[weaponLevel].isactive = true;
                    //存储档案
                    IGamerProfile.Instance.SaveGamerProfileToServer();
                }
            }
        }
    }
Exemplo n.º 14
0
    public virtual void Death(bool isEffect, bool isDivide, bool isCoin, bool isProp)
    {
        IsDeath = true;
        int level = VirusGameDataAdapter.GetLevel();
        int coin  = VirusTool.GetVirusDeathCoin(level);

        if (isEffect)
        {
            float scale     = transform.localScale.x;
            int   index     = Random.Range(1, 5);
            var   explosion = EffectPools.Instance.Spawn("Explosion" + index);
            explosion.transform.localScale = new Vector3(scale * 2f, scale * 2f, 1);
            explosion.transform.position   = transform.position;
            explosion.GetComponent <VirusFragmentMrg>().Initi(index - 1, Random.Range(5, 10));
            VirusSoundMrg.Instance.PlaySound(VirusSoundType.VirusDeath);
            VirusCameraShake.Instance.Shake();
        }

        if (isCoin)
        {
            if (coin > 0)
            {
                VirusGameDataAdapter.AddLevelCoin(coin);
                int count = Random.Range(1, 4);
                for (int i = 0; i < count; i++)
                {
                    EventManager.TriggerEvent(new UIVirusAddLevelCoinEvent(transform.position));
                }
            }
        }

        if (isProp)
        {
            string propName = VirusTool.GetPropName(level);
            if (!propName.Equals("None") && SplitLevel > SplitLevel.Level1)
            {
                var prop = PropPools.Instance.Spawn(propName + "Prop");
                prop.transform.position = transform.position;
                prop.GetComponent <VirusPropMove>().Initi();
                ScenePropMrg.Instance.Add(prop);
            }
        }
        VirusMrg.Instance.Remove(gameObject);
    }
Exemplo n.º 15
0
 protected void Divide(string virusName, ColorLevel colorLevel, int count)
 {
     if (SplitLevel > SplitLevel.Level1)
     {
         Vector3 pos   = transform.position;
         var     level = SplitLevel - 1;
         var     move  = transform.GetComponent <VirusMove>();
         for (int i = 0; i < count; i++)
         {
             VirusData data1 = new VirusData();
             data1.VirusColorLevel = VirusTool.GetColorLevel(colorLevel);
             data1.SplitLevel      = level;
             data1.MoveSpeed       = move.OriginSpeed;
             data1.MoveDirection   = Quaternion.Euler(0, 0, Random.Range(-45f, 45f)) * Vector3.up;
             data1.HealthValue     = VirusTool.GetVirusHealthByColorLevel(virusName, VirusGameDataAdapter.GetLevel(), data1.VirusColorLevel);
             VirusMrg.Instance.SpawnVirus(virusName, data1, pos, false);
         }
     }
 }
Exemplo n.º 16
0
        protected override void RunAway()
        {
            var move = transform.GetComponent <VirusMove>();

            for (int i = 0; i < 3; i++)
            {
                int        level      = (int)(SplitLevel - 1);
                SplitLevel splitLevel = level < 0 ? SplitLevel.Level1 : (SplitLevel)level;
                float      angle      = Random.Range(i * 120, (i + 1) * 120);
                VirusData  data       = new VirusData();
                data.VirusColorLevel = VirusTool.GetColorLevel(CurColorLevel);
                data.SplitLevel      = splitLevel;
                data.MoveSpeed       = move.OriginSpeed;
                data.MoveDirection   = Quaternion.Euler(0, 0, angle) * Vector3.right;
                int t = VirusGameDataAdapter.GetLevel();
                data.HealthValue = VirusTool.GetVirusHealthByColorLevel("DartVirus", t, data.VirusColorLevel);
                VirusMrg.Instance.SpawnVirus("DartVirus", data, transform.position, true);
            }
        }
Exemplo n.º 17
0
        private void RefreshWeaponPanelUIInfo()
        {
            var lv     = VirusPlayerDataAdapter.GetCurWeaponLevel();
            var weapon = VirusPlayerDataAdapter.GetWeaponData(lv);

            int fireNeedCoin  = VirusTool.GetUpgradeCoin(weapon.fire);
            int speedNeedCoin = VirusTool.GetUpgradeCoin(weapon.speed);

            textWeaponFireLv.text    = $"[Lv{weapon.fire}]";
            textWeaponFireValue.text = $"{weapon.fire*10}";
            textWeaponFireCoin.text  = $"x{fireNeedCoin}";

            textWeaponSpeedLv.text    = $"[Lv{weapon.speed}]";
            textWeaponSpeedValue.text = $"{weapon.speed*10}";
            textWeaponSpeedCoin.text  = $"x{speedNeedCoin}";

            btnWeaponFire.interactable  = CheckCoin(fireNeedCoin);
            btnWeaponSpeed.interactable = CheckCoin(speedNeedCoin);
        }
        private void Produce()
        {
            VirusData data = new VirusData();

            data.SplitLevel      = SplitLevel;
            data.VirusColorLevel = CurColorLevel;
            data.HealthValue     = VirusTool.GetVirusHealthByColorLevel("SwallowVirus", VirusGameDataAdapter.GetLevel(), CurColorLevel);
            data.MoveSpeed       = 4;
            data.MoveDirection   = Quaternion.Euler(0, 0, Random.Range(0f, 360f)) * Vector3.up;

            float scale    = VirusTool.GetScaleByLevel(data.SplitLevel);
            var   newVirus = VirusMrg.Instance.SpawnVirus("SwallowVirus", data, transform.position, true);

            newVirus.transform.localScale = Vector3.zero;
            newVirus.transform.DOScale(new Vector3(scale, scale, 1), 0.5f).OnComplete(() =>
            {
                _isRunAway = false;
            });
        }
    public static int Load(int level)
    {
        _data      = new WaveVirusData();
        _nameRoll  = new ChanceRoll();
        _colorRoll = new ChanceRoll();
        WaveIndex  = 0;
        IsNextWave = true;
        if (IGamerProfile.Instance != null)
        {
            string bossType = IGamerProfile.gameLevel.mapData[level - 1].bossData.BossType;
            _data.HasBoss = bossType == "" ? false : true;
            if (_data.HasBoss == true)
            {
                _curBossName = GetBossVirusName(bossType);
            }
        }
        else
        {
            if (level == 2 || level % 5 == 0)
            {
                _data.HasBoss = true;
                _curBossName  = GetBossVirusName(level);
            }
        }

        FillCache(level);
        FillVirusNames(level);
        FillNameRoll();
        FillColorRoll(level);
        int endValue = FillData();

        if (_data.HasBoss)
        {
            WaveVirusItem boss = new WaveVirusItem();
            boss.SplitLevel = SplitLevel.Level5;
            boss.ColorLevel = ColorLevel.Level0;
            boss.VirusName  = _curBossName;
            _data.Data[MaxWave - 1].Insert(0, boss);
            endValue += VirusTool.GetChildSplit(SplitLevel.Level5, boss.VirusName);
        }
        return(endValue);
    }
Exemplo n.º 20
0
    public virtual void Born(VirusData virusData)
    {
        VirusSprite = transform.GetComponent <BaseVirusSprite>();
        VirusSprite.Initi(virusData.VirusColorLevel);
        VirusHealth       = new RectiveProperty <float>();
        VirusHealth.Value = virusData.HealthValue;
        HealthBar.Initi(VirusTool.GetStrByIntger(virusData.HealthValue));
        VirusHealth.Subscibe(HealthBar.SetValue);

        SplitLevel       = virusData.SplitLevel;
        CurColorLevel    = virusData.VirusColorLevel;
        OriginColorLevel = virusData.VirusColorLevel;
        TotalHealth      = virusData.HealthValue;

        ScaleX = VirusTool.GetScaleByLevel(virusData.SplitLevel);
        transform.localScale = new Vector3(ScaleX, ScaleX, 1);
        VirusMove.Initi(virusData.MoveSpeed, virusData.MoveDirection);

        transform.GetComponent <VirusBuffMrg>().Initi();
        IsDeath = false;
    }
Exemplo n.º 21
0
        public override void Injured(float damageValue, bool isEffect)
        {
            if (VirusHealth.Value - damageValue <= 0)
            {
                Death(true, true, true, true);
                return;
            }
            VirusHealth.Value -= damageValue;
            var virusLevel = VirusTool.GetVirusColorLevel("VampireVirus", VirusGameDataAdapter.GetLevel(), VirusHealth.Value);

            if (virusLevel != CurColorLevel)
            {
                CurColorLevel = virusLevel;
                VirusSprite.Initi(CurColorLevel);
                transform.GetComponent <BubbleEffectMrg>().SetBubbleSprite(CurColorLevel);
            }
            if (isEffect)
            {
                virusHurtEffect.StartHurtEffect();
            }
        }
Exemplo n.º 22
0
        void ShowCoinData()
        {
            int coin     = VirusGameDataAdapter.GetCurLevelCoin();
            int jiaCheng = UnityEngine.Random.Range(10, 100);

            if (IGamerProfile.Instance != null)
            {
                UiSceneSelectGameCharacter.CharacterId     id = UiSceneSelectGameCharacter.CharacterId.ShouYi;
                IGamerProfile.PlayerData.PlayerChacterData dt = IGamerProfile.Instance.playerdata.characterData[(int)id];
                GameCharacter.CharacterData characterDt       = IGamerProfile.gameCharacter.characterDataList[(int)id];
                jiaCheng = characterDt.LevelBToVal.GetValue(dt.levelB); //关卡加成
            }

            int jiaChengCoin = Mathf.CeilToInt(jiaCheng * coin / 100f);
            int totalCoin    = coin + jiaChengCoin;

            _coinData.CoinText.text         = VirusTool.GetStrByIntger(coin);
            _coinData.TotalCoinText.text    = VirusTool.GetStrByIntger(totalCoin);
            _coinData.JiaChengText.text     = jiaCheng.ToString() + "%:";
            _coinData.JiaChengCoinText.text = VirusTool.GetStrByIntger(jiaChengCoin);
        }
Exemplo n.º 23
0
 private void Update()
 {
     if (_isLerp)
     {
         int totalCoin = VirusGameDataAdapter.GetTotalCoin();
         _lastCoin = Mathf.Lerp(_lastCoin, totalCoin, Time.deltaTime * 5);
         if (Mathf.Abs(_lastCoin - totalCoin) < 0.1f)
         {
             _isLerp = false;
             _isSet  = false;
         }
         _coinText.text = VirusTool.GetStrByIntger(Mathf.RoundToInt(_lastCoin));
         _totalTime    -= Time.deltaTime;
         if (_totalTime <= 0 && _num > 0)
         {
             _num--;
             VirusSoundMrg.Instance.PlaySound(VirusSoundType.TotalCoin);
             _totalTime = 0.15f;
         }
     }
 }
    private IEnumerator Spawn()
    {
        List <WaveVirusItem> items = WaveVirusDataAdapter.GetWaveVirus();

        int count = items.Count;
        int cc    = 0;

        _isSpawned = false;
        while (true)
        {
            yield return(new WaitForSeconds(Random.Range(0.3f, 0.8f)));

            VirusData  data       = new VirusData();
            Vector3    dir        = Quaternion.Euler(0, 0, Random.Range(-20f, 20f)) * Vector3.down;
            SplitLevel splitLevel = items[cc].SplitLevel;
            string     virusName  = items[cc].VirusName.ToString();

            int level = VirusGameDataAdapter.GetLevel();
            data.VirusColorLevel = items[cc].ColorLevel;
            data.HealthValue     = VirusTool.GetVirusHealthByColorLevel(virusName, level, data.VirusColorLevel);
            data.MoveSpeed       = 3;
            data.MoveDirection   = dir;
            data.SplitLevel      = splitLevel;
            SpawnVirus(virusName, data);

            cc++;
            if (cc >= count)
            {
                _isSpawned = true;
                WaveVirusDataAdapter.WaveIndex++;
                if (WaveVirusDataAdapter.WaveIndex >= WaveVirusDataAdapter.MaxWave)
                {
                    WaveVirusDataAdapter.IsNextWave = false;
                }
                yield break;
            }
        }
    }
        public void OnEvent(UIVirusAddTotalCoinEvent eventType)
        {
            Vector2 pos  = eventType.UiPos;
            var     coin = PropPools.Instance.Spawn("Coin");

            coin.transform.SetParent(coinParent);
            var rectTransform = coin.transform as RectTransform;

            rectTransform.localScale = Vector3.one;
            if (rectTransform != null)
            {
                rectTransform.anchoredPosition = pos;
                Vector2 e   = _coinBg.anchoredPosition;
                Vector2 s   = pos;
                Vector2 dir = Quaternion.Euler(0, 0, -90) * (e - s).normalized;
                float   mul = eventType.IsPositive ? 1f : -1f;
                float   t1  = Random.Range(-0.5f, 0.5f);
                Vector2 mid = Vector2.Lerp(s, e, t1) + mul * dir * Random.Range(1.0f, 2.0f) * 200f;
                float   dis = (e - s).magnitude;
                DOVirtual.Float(0, 10, dis / 1500f, (t) =>
                {
                    Vector2 p = VirusTool.GetBesselPoint(s, e, mid, t / 10f);
                    rectTransform.anchoredPosition = p;
                }).OnComplete(() =>
                {
                    PropPools.Instance.DeSpawn(coin);
                    _isLerp = true;
                    if (!_isSet)
                    {
                        _isSet     = true;
                        _totalTime = 0.15f;
                        _num       = 5;
                        VirusSoundMrg.Instance.PlaySound(VirusSoundType.TotalCoin);
                    }
                });
            }
        }
Exemplo n.º 26
0
        public override void Injured(float damageValue, bool isEffect)
        {
            if (VirusHealth.Value - damageValue <= 0)
            {
                Death(true, true, true, true);
                return;
            }
            VirusHealth.Value -= damageValue;
            var virusLevel = VirusTool.GetVirusColorLevel("RegenerativeVirus", VirusGameDataAdapter.GetLevel(), VirusHealth.Value);

            if (virusLevel != CurColorLevel)
            {
                CurColorLevel = virusLevel;
                VirusSprite.Initi(CurColorLevel);
                transform.GetComponent <BubbleEffectMrg>().SetBubbleSprite(CurColorLevel);
            }
            if (isEffect)
            {
                _virusHurtEffect.StartHurtEffect();
            }
            _virusHealthAddEffect.StopHealthEffect(this);
            _totalTime = 0.5f;
            _ishurt    = true;
        }
Exemplo n.º 27
0
    public void SetValue(float value)
    {
        int vv = Mathf.CeilToInt(value);

        _healthText.text = VirusTool.GetStrByIntger(vv);
    }
 public void SetCoinText()
 {
     _coinText.text = VirusTool.GetStrByIntger(VirusGameDataAdapter.GetTotalCoin());
     //Debug.Log("test ======== " + _coinText.text);
 }
Exemplo n.º 29
0
 public void SetCoinText(int coin)
 {
     _coinText.text = VirusTool.GetStrByIntger(coin);
 }
Exemplo n.º 30
0
    private void OnUpgradeEnter()
    {
        //这里是对玩家武器进行升级
        bool   isUpdgrade = false;
        string tipStr     = "";

        if (IGamerProfile.Instance == null)
        {
            int coin     = VirusGameDataAdapter.GetTotalCoin();
            int needCoin = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetWeaponLevel());
            //coin = 50 * needCoin; //testSyq
            while (true)
            {
                if (coin >= needCoin)
                {
                    isUpdgrade = true;
                    int value = VirusPlayerDataAdapter.GetUpgradeValue();
                    //扣除玩家金币
                    VirusGameDataAdapter.MinusTotalCoin(needCoin);
                    //增加武器等级
                    VirusPlayerDataAdapter.AddWeaponLevel();
                    //增加武器伤害
                    VirusPlayerDataAdapter.AddShootPower(value);
                    //增加子弹射速,暂时无用
                    VirusPlayerDataAdapter.AddShootSpeed();

                    bool b1 = VirusPlayerDataAdapter.GetShootNum() <= VirusPlayerDataAdapter.GetMaxShootNum();
                    bool b2 = VirusPlayerDataAdapter.UpgradeShoot();
                    if (b1 && b2)
                    {
                        //增加武器发射的子弹数量
                        VirusPlayerDataAdapter.AddShootNum(1);
                    }

                    coin = VirusGameDataAdapter.GetTotalCoin();
                    //升级需要的金币数
                    needCoin = VirusTool.GetUpgradeCoin(VirusPlayerDataAdapter.GetWeaponLevel());
                }
                else
                {
                    break;
                }
            }

            if (isUpdgrade)
            {
                _uiMrg.CoinPanel.SetCoinText();
                _virusPlayer.Upgrade();
                VirusSoundMrg.Instance.PlaySound(VirusSoundType.UpgradeGun);
                tipStr = "火力升级";
            }
        }
        else
        {
            //对于玩家的武器属性进行配置
            int indexWeapon = (int)UiSceneSelectGameCharacter.CharacterId.MainWeapon;
            //int levelA = IGamerProfile.Instance.playerdata.characterData[indexWeapon].levelA;
            int levelB = IGamerProfile.Instance.playerdata.characterData[indexWeapon].levelB;
        }

        float delayTime = 0.1f;
        //int level = VirusTool.UnlockViceWeapon(VirusGameDataAdapter.GetLevel());
        int level = 0;

        //获取玩家选择的副武器
        if (IGamerProfile.Instance != null)
        {
            level = IGamerProfile.Instance.gameEviroment.characterIndex;
        }
        //level = 8; //testSyq
        if (level > 0)
        {
            if (_virusPlayer.WeaponLevel != level)
            {
                _virusPlayer.WeaponLevel = level;
                //这里是升级副武器的
                delayTime = 0.1f;
                _virusPlayer.InitiViceWeapon(level);
                tipStr = "装备升级";
            }
        }

        if (!string.IsNullOrEmpty(tipStr))
        {
            var tip = EffectPools.Instance.Spawn("FloatTip");
            tip.transform.position   = _virusPlayer.transform.position;
            tip.transform.localScale = new Vector3(1.5f, 1.5f, 1);
            tip.GetComponent <FastlaneFloatTip>().Float(tipStr, () => { EffectPools.Instance.DeSpawn(tip); });
        }

        DOVirtual.DelayedCall(delayTime, _uiMrg.FadeOut).OnComplete(() =>
        {
            _fsm.ChangeState(VirusGameState.GamePlay);
        });
    }