コード例 #1
0
    //子弹爆炸,销毁子弹
    protected virtual void DoBulletBomb()
    {
        if (InCache)
        {
            return;
        }

        //播放爆炸特效
        if (Deploy.bombEffectId > 0)
        {
            var pos     = Renderer.transform.position;
            var forward = MoveData.Forward;
            var speed   = Deploy.bombEffectSpeed;
            TextureEffectFactroy.CreateEffect(Deploy.bombEffectId, SortingOrder.EnemyBullet, effect =>
            {
                effect.transform.position = pos;
                effect.AutoDestroy();
                if (speed > 0)
                {
                    effect.SetAutoMove(forward, speed);
                }
            });
        }

        //销毁子弹
        BulletFactory.DestroyBullet(this);
    }
コード例 #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
ファイル: MarisaLaser.cs プロジェクト: zhfelon1/th-haruhi
    public override void Init(BulletDeploy deploy, Transform master, MeshRenderer model)
    {
        _material = model.material;
        base.Init(deploy, master, model);

        //初始化被击特效
        TextureEffectFactroy.CreateEffect(HitEffectId, SortingOrder.Effect, e =>
        {
            _hitEffect = e;
            _hitEffect.SetActiveSafe(false);
        });
    }
コード例 #4
0
ファイル: EnemyBullet.cs プロジェクト: zhfelon1/th-haruhi
    //检测玩家死亡时,是否需要自我销毁并播放特效
    private bool CheckBulletExplosion()
    {
        if (!BulletExplosion.InExplosion)
        {
            return(false);
        }
        var pos     = CacheTransform.position;
        var radius  = BulletExplosion.Radius;
        var sqrDist = MathUtility.SqrDistanceXY(pos, BulletExplosion.Center);

        if (sqrDist < radius * radius)
        {
            BulletFactory.DestroyBullet(this);
            TextureEffectFactroy.CreateEffect(501, SortingOrder.ShootEffect, effect =>
            {
                effect.Renderer.material.SetColor("_TintColor", ColorUtility.GetColor(Deploy.ExplosionColor));
                effect.transform.position = pos;
                effect.AutoDestroy();
            });
            return(true);
        }
        return(false);
    }
コード例 #5
0
ファイル: PlayerSupport.cs プロジェクト: zhfelon1/th-haruhi
    public void Init(PlayerSupportDeploy deploy, GameObject renderObj)
    {
        Deploy = deploy;

        if (deploy.slowShootEffectId > 0)
        {
            TextureEffectFactroy.CreateEffect(deploy.slowShootEffectId, SortingOrder.Effect, obj =>
            {
                _slowEffect = obj;
                _slowEffect.transform.Bind(renderObj.transform);
                _slowEffect.SetActiveSafe(false);
            });
        }

        if (deploy.fastShootEffectId > 0)
        {
            TextureEffectFactroy.CreateEffect(deploy.fastShootEffectId, SortingOrder.Effect, obj =>
            {
                _fastEffect = obj;
                _fastEffect.transform.Bind(renderObj.transform);
                _fastEffect.SetActiveSafe(false);
            });
        }
    }
コード例 #6
0
    public void AddSupport()
    {
        var deploy = TableUtility.GetDeploy <PlayerSupportDeploy>(_master.Deploy.supprotId);

        if (deploy == null)
        {
            Debug.LogError("僚机ID不存在:" + _master.Deploy.supprotId);
            return;
        }

        var gameObj = new GameObject("support");

        gameObj.transform.SetParent(null, false);
        gameObj.transform.localScale = _master.transform.localScale;
        gameObj.transform.position   = _master.transform.position;

        TextureEffectFactroy.CreateEffect(deploy.idleEffectId, SortingOrder.PlayerSupport, effect =>
        {
            effect.transform.Bind(gameObj.transform);
            var script = gameObj.AddComponent <PlayerSupport>();
            script.Init(deploy, effect.gameObject);
            _supportList.Add(script);
        });
    }