Ejemplo n.º 1
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);
         }
     }
 }
Ejemplo n.º 2
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);
            }
        }