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