Ejemplo n.º 1
0
 /// <summary>
 /// 开始
 /// </summary>
 public override void Begin()
 {
     // 加载特效预设
     effectObject = PoolLoader.Instance().Load(effectKey, EffectsFactory.EffectPackName, parent);
     if (effectObject == null)
     {
         throw new Exception("特效为空, 加载失败:" + effectKey);
     }
     //effectObject = Instantiate(effectObject);
     // 设置数据
     effectObject.transform.localScale = scale;
     effectObject.transform.position   = position;
     effectObject.layer = layer;
     // 单位旋转
     if (rotate != Vector2.zero)
     {
         effectObject.transform.Rotate(Vector3.right, rotate.x);
         effectObject.transform.Rotate(Vector3.up, rotate.y);
     }
     // TODO 特效播放速度
     // 特效持续时间
     new Timer(durTime).OnCompleteCallback(() =>
     {
         if (completeCallback != null)
         {
             completeCallback();
         }
         // 回收对象
         PoolLoader.Instance().CircleBack(effectObject);
         //Destroy();
     }).Start();
 }
Ejemplo n.º 2
0
    /// <summary>
    /// 开始移动
    /// </summary>
    public override void Begin()
    {
        // 加载特效预设
        effectObject = PoolLoader.Instance().Load(effectKey, EffectsFactory.EffectPackName, parent);
        if (effectObject == null)
        {
            throw new Exception("特效为空, 加载失败.");
        }
        //effectObject = Instantiate(effectObject);
        // 设置数据
        effectObject.transform.localScale = scale;
        effectObject.transform.position   = position;
        effectObject.layer = layer;
        // 开始移动
        // 创建弹道
        ballistic = BallisticFactory.Single.CreateBallistic(effectObject, position, targetObj.transform.position - position, targetObj, speed, 1, trajectoryType: flyType);

        ballistic.OnKill = (ballistic1, target) =>
        {
            effectObject.RemoveComponents(typeof(Ballistic));
            PoolLoader.Instance().CircleBack(effectObject);
        };
        // 运行完成
        ballistic.OnComplete = (a, b) =>
        {
            if (completeCallback != null)
            {
                completeCallback();
            }
            a.Kill();
            //Destroy();
        };
    }
Ejemplo n.º 3
0
 /// <summary>
 /// 结束战斗
 /// </summary>
 public void EndFight()
 {
     // 结束流程
     // 清理数据
     FightDataStatistical.Single.Clear();
     FightDataSyncer.Single.Clear();
     PoolLoader.Instance().Clear();
     DisplayerManager.Single.Clear();
     DataManager.Single.Clear();
     ClusterManager.Single.ClearAll();
 }
Ejemplo n.º 4
0
    /// <summary>
    /// 开始效果
    /// </summary>
    public override void Begin()
    {
        // 加载特效预设
        effectObject = PoolLoader.Instance().Load(effectKey, EffectsFactory.EffectPackName, parent);
        if (effectObject == null)
        {
            throw new Exception("特效为空, 加载失败.");
        }
        effectObject.transform.localScale    = new Vector3(1, 1, 1);
        effectObject.transform.localPosition = Vector3.zero;

        // 获取lineRanderer
        var lineRandererControl = effectObject.GetComponent <LineRandererControl>();

        if (lineRandererControl == null)
        {
            lineRandererControl = effectObject.AddComponent <LineRandererControl>();
        }

        switch (lineType)
        {
        case 0:
            // 设置两点
            lineRandererControl.ReleasePos = releasePos;
            lineRandererControl.ReceivePos = receivePos;
            break;

        case 1:
            // 设置两对象
            lineRandererControl.ReleaseObj = effectObject;
            lineRandererControl.ReceiveObj = receiveObj;
            break;
        }
        lineRandererControl.LineType = lineType;

        // 定时关闭
        new Timer(durTime).OnCompleteCallback(() =>
        {
            PoolLoader.Instance().CircleBack(effectObject);
        }).Start();
    }
Ejemplo n.º 5
0
 /// <summary>
 /// 销毁
 /// </summary>
 public override void Destroy()
 {
     PoolLoader.Instance().CircleBack(effectObject);
 }