示例#1
0
    protected override void Update()
    {
        base.Update();

        if (SpriteList.Count <= 1)
        {
            return;
        }
        if (Deploy.frame <= 0)
        {
            return;
        }

        if (GameSystem.FixedFrameCount - _lastChangedFrame > Deploy.frame)
        {
            _lastChangedFrame = GameSystem.FixedFrameCount;
            _currSpriteIndex++;
            if (_currSpriteIndex >= SpriteList.Count)
            {
                if (_bAutoDestroy)
                {
                    TextureEffectFactroy.DestroyEffect(this);
                    return;
                }
                _currSpriteIndex = 0;
            }
            Renderer.material.mainTexture = SpriteList[_currSpriteIndex].texture;
        }
    }
示例#2
0
    public void PlayShootEffect(EColor color, float startScale = 1f, Vector3?startPos = null)
    {
        var effectId = 0;

        switch (color)
        {
        case EColor.Red:
            effectId = 901;
            break;

        case EColor.Purple:
            effectId = 902;
            break;

        case EColor.Blue:
            effectId = 903;
            break;

        case EColor.BlueLight:
            effectId = 904;
            break;

        case EColor.Green:
            effectId = 905;
            break;

        case EColor.Yellow:
            effectId = 906;
            break;

        case EColor.Orange:
            effectId = 907;
            break;

        case EColor.White:
            effectId = 908;
            break;
        }

        if (effectId > 0)
        {
            var pos = startPos == null ? transform.position : (Vector3)startPos;
            TextureEffectFactroy.CreateEffect(effectId, SortingOrder.ShootEffect, effect =>
            {
                effect.transform.position   = pos;
                effect.transform.localScale = Vector3.one * startScale;
                effect.transform.DOScale(0f, 0.4f).onComplete = () =>
                {
                    TextureEffectFactroy.DestroyEffect(effect);
                };
            });
        }
    }
示例#3
0
 public void Destroy()
 {
     if (_currBullet != null)
     {
         BulletFactory.DestroyBullet(_currBullet);
         _currBullet = null;
     }
     if (_slowEffect != null)
     {
         TextureEffectFactroy.DestroyEffect(_slowEffect);
         _slowEffect = null;
     }
     if (_fastEffect != null)
     {
         TextureEffectFactroy.DestroyEffect(_fastEffect);
         _fastEffect = null;
     }
     Destroy(gameObject);
 }