Esempio n. 1
0
    IEnumerator CreateAsync(System.Action <PreviewEntourage> _callback = null)
    {
        if (isDummy_ == false)
        {
            GameSys.LogError("You can only start create other player in dummy: " + actorInfo.ServerInstanceID);
            yield break;
        }
        //
        isDownloading_ = true;                          //判断是否正在下载,防止重复创建

        PreviewEntourage       opc            = null;
        SmartActorRendererCtrl myRendererCtrl = null;
        bool faild = false;

        pendingDownload = Create(actorInfo, delegate(PreviewEntourage _opc, EResult _result)
        {
            if (_result != EResult.Success)
            {
                faild = true;
                return;
            }

            opc             = _opc;
            pendingDownload = null;
            myRendererCtrl  = opc.gameObject.GetComponentInChildrenFast <SmartActorRendererCtrl>();
            myRendererCtrl.Show(false);
        });
        if (mutualExclusion)
        {
            GameCenter.previewManager.PushDownLoadTask(pendingDownload);
        }
        while (opc == null || opc.inited == false)
        {
            if (faild)
            {
                yield break;
            }
            yield return(null);
        }
        if (mutualExclusion)
        {
            GameCenter.previewManager.EndDownLoadTask(pendingDownload);
        }
        pendingDownload = null;
        isDownloading_  = false;


        if (_callback != null)
        {
            _callback(opc);
        }
    }
Esempio n. 2
0
    IEnumerator CreateAsync(System.Action _callback = null)
    {
        if (isDummy_ == false)
        {
            Debug.LogError("You can only start create other player in dummy: " + actorInfo.ServerInstanceID);
            yield break;
        }
        //
        isDownloading_ = true;                          //判断是否正在下载,防止重复创建

        OtherEntourage         opc            = null;
        SmartActorRendererCtrl myRendererCtrl = null;
        bool faild = false;

        pendingDownload = Create(actorInfo, delegate(OtherEntourage _opc, EResult _result)
        {
            if (_result != EResult.Success)
            {
                faild = true;
                return;
            }

            opc             = _opc;
            pendingDownload = null;
            myRendererCtrl  = opc.gameObject.GetComponentInChildrenFast <SmartActorRendererCtrl>();
            myRendererCtrl.Show(false);
        });
        while (opc == null || opc.inited == false)
        {
            if (faild)
            {
                yield break;
            }
            yield return(null);
        }

        pendingDownload = null;
        isDownloading_  = false;

        if (!actorInfo.IsAlive)
        {
            opc.Dead(true);
        }
        if (_callback != null)
        {
            _callback();
        }
    }
Esempio n. 3
0
    /// <summary>
    /// 尽量避免使用Awake等unity控制流程的接口来初始化,而改用自己调用的接口 by吴江
    /// </summary>
    protected override void Init()
    {
        height     = actorInfo.NameHeight;
        nameHeight = height;
        base.Init();
        if (headTextCtrl == null)
        {
            headTextCtrl = this.gameObject.AddComponent <HeadTextCtrl>();
        }
        animFSM = base.animFSM as SmartActorAnimFSM;
        if (animFSM == null)
        {
            animFSM = this.gameObject.GetComponentInChildrenFast <SmartActorAnimFSM>(true);
        }

        rendererCtrl = base.rendererCtrl as SmartActorRendererCtrl;
        if (rendererCtrl == null)
        {
            rendererCtrl = this.gameObject.GetComponentInChildrenFast <SmartActorRendererCtrl>(true);
        }
        ActiveBoxCollider(false, 0f);//宠物不可点击,仅设置false不行,在隐藏再显示后会变为true。所以赋值0
        rendererCtrl.Init(actorInfo, fxCtrl);
        animationRoot.gameObject.transform.localScale *= actorInfo.ModelScale;

        if (animFSM != null)
        {
            animFSM.SetMoveSpeed(CurRealSpeed / (actorInfo.AnimationMoveSpeedBase * actorInfo.ModelScale));
            animFSM.OnDeadEnd = OnDeadEnd;
        }

        GameObject obj = new GameObject("ShokWaveObj");

        obj.transform.parent           = this.transform;
        obj.transform.localPosition    = Vector3.zero;
        obj.transform.localEulerAngles = Vector3.zero;
        AfsShockWave afsShockWave = obj.AddComponent <AfsShockWave>();

        afsShockWave.ShockSpeed = 1.0f;
        afsShockWave.ShockPower = 1.0f;
        afsShockWave.ShockDelay = 1.0f;
        Rigidbody rigidbody = obj.AddComponent <Rigidbody>();

        rigidbody.useGravity  = false;
        rigidbody.isKinematic = true;
    }
Esempio n. 4
0
 /// <summary>
 /// 尽量避免使用Awake等unity控制流程的接口来初始化,而改用自己调用的接口 by吴江
 /// </summary>
 protected override void Init()
 {
     base.Init();
     if (actorInfo != null)
     {
         id = actorInfo.ServerInstanceID;
     }
     rendererCtrl = base.rendererCtrl as SmartActorRendererCtrl;
     animFSM      = base.animFSM as SmartActorAnimFSM;
     foreach (BuffInfo item in actorInfo.BuffList.Values)
     {
         OnBuffUpdate(item.BuffTypeID, true);
     }
     if (GameCenter.curMainPlayer != null)
     {
         IsFriend = !PlayerAutoFightFSM.IsEnemy(this);
     }
 }