Beispiel #1
0
        public virtual void Reset(int id, float hp, int size, float speed, Vector2 pos, Vector2 direction, Vector2 hpRange, bool isMatrix)
        {
            this.id        = id;
            table          = TableVirus.Get(id);
            cd             = table.skillCD;
            hpTotal        = hp;
            this.hp        = hp;
            this.size      = size;
            this.speed     = speed;
            this.hpRange   = hpRange;
            this.direction = direction;
            this.isMatrix  = isMatrix;
            isAlive        = true;
            position       = pos;
            isInvincible   = false;
            rectTransform.anchoredPosition = pos;
            scale  = GetSizeScale(size);
            radius = baseRadius * scale;
            rectTransform.localScale = Vector3.one * scale;

            mLastColorIndex      = -1;
            mLastHp              = -1;
            mLastScale           = 1f;
            mLastHitSlowdownTime = 0;
            mStunCD              = 0;

            cureEffect.Stop(true);
            stunEffect.Stop(true);
        }
        public TableVirus Get(int id)
        {
            TableVirus data = null;

            _ins.mDict.TryGetValue(id, out data);
            return(data);
        }
Beispiel #3
0
        private void SpawnVirus()
        {
            var direction = Quaternion.AngleAxis(CT.table.spawnVirusDirection.random, Vector3.forward) * Vector2.down;
            var pos       = new Vector2(Random.Range(VirusBase.baseRadius, UIUtil.width - VirusBase.baseRadius), UIUtil.height + VirusBase.baseRadius);

            var virusIndex = FormulaUtil.RandomIndexInProbArray(tableGameWave.virusProb);
            var virusTable = TableVirus.Get(tableGameWave.virus[virusIndex]);
            var virusType  = "DestroyViruses." + virusTable.type;
            var virus      = (VirusBase)EntityManager.Create(System.Type.GetType(virusType));

            var hpRange = new Vector2(tableGameLevel.hpRange.min, tableGameLevel.hpRange.max);
            var hp      = tableGameWave.virusHp[virusIndex].random * tableGameLevel.virusHpFactor * mHpFixFactor * CT.table.hpRandomRange.random;
            var speed   = tableGameWave.virusSpeed[virusIndex].random * tableGameLevel.virusSpeedFactor * mSpeedFixFactor * CT.table.speedRandomRange.random;
            var size    = tableGameWave.virusSize[virusIndex].random;

            virus.Reset(virusTable.id, hp, size, speed, pos, direction, hpRange, true);
        }
Beispiel #4
0
        protected override void OnOpen()
        {
            base.OnOpen();
            this.BindUntilDisable <EventGameData>(OnEventGameData);
            mVirus.Clear();
            foreach (var v in TableVirus.GetAll())
            {
                if (v.collectable <= 0)
                {
                    continue;
                }
                var _data = new VirusData();
                _data.SetData(v.id);
                mVirus.Add(_data);
            }
            mVirus.Sort((a, b) => b.isUnlock.CompareTo(a.isUnlock));

            Refresh();

            fadeGroup.FadeIn(() =>
            {
                NavigationView.BlackSetting(true);
            });
        }
 public void SetData(int id)
 {
     this.id    = id;
     this.table = TableVirus.Get(id);
 }