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); }
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); }
public void SetData(int id) { this.id = id; this.table = TableVirus.Get(id); }