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

        MainEntourage mpc = null;

        pendingDownload = Create(actorInfo, delegate(MainEntourage _mpc, EResult _result)
        {
            if (_result != EResult.Success)
            {
                return;
            }

            mpc = _mpc;
            mpc.Show(true);
            pendingDownload = null;
            isDownloading_  = false;
            if (!actorInfo.IsAlive)
            {
                mpc.Dead(true);
            }
            if (_callback != null)
            {
                _callback(this);
            }
        });
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 创建净数据对象
    /// </summary>
    /// <param name="_id"></param>
    /// <returns></returns>
    public static MainEntourage CreateDummy(MercenaryInfo _info)
    {
        GameObject newGO = null;

        if (GameCenter.instance.dummyOpcPrefab != null)
        {
            newGO      = Instantiate(GameCenter.instance.dummyOpcPrefab) as GameObject;
            newGO.name = "Dummy MPC [" + _info.ServerInstanceID + "]";
        }
        else
        {
            newGO = new GameObject("Dummy MPC[" + _info.ServerInstanceID + "]");
        }
        newGO.tag = "Entourage";
        newGO.SetMaskLayer(LayerMask.NameToLayer("Entourage"));
        MainEntourage newMPC = newGO.AddComponent <MainEntourage>();

        newMPC.isDummy_ = true;
        newMPC.moveFSM  = newGO.AddComponent <MainEntourageMoveFSM>();
        MainEntourageMoveFSM movefsm = newMPC.moveFSM as MainEntourageMoveFSM;

        movefsm.SetInfo(_info);
        newMPC.id           = _info.ServerInstanceID;
        newMPC.actorInfo    = _info;
        newMPC.curMoveSpeed = newMPC.actorInfo.StaticSpeed * MOVE_SPEED_BASE;
        newMPC.CurRealSpeed = newMPC.curMoveSpeed;
        newMPC.InitPos();
        return(newMPC);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 清理所有的硬直状态(一般是由于切换场景)
    /// </summary>
    //public void CleanLockState()
    //{
    //    foreach (var item in lockStateList.Keys)
    //    {
    //        C2S_FinishedLockState(item);
    //    }
    //    lockStateList.Clear();
    //}

    /// <summary>
    /// 设置佣兵信息 by吴江
    /// </summary>
    /// <param name="_info"></param>
    public void SetEntourage(MainEntourage _entourage, MercenaryInfo _info)
    {
        entourage = _entourage;
        entourageDefaultAbilityList.Clear();
        entourageNormalAbility = null;
        if (entourage == null)
        {
            return;
        }

        for (int i = 0; i < _info.PetSkillList.Count; i++)
        {
            AbilityInstance instance = new AbilityInstance((int)_info.PetSkillList[i], 1, 1, entourage, null);
            instance.FullCD();
            entourageDefaultAbilityList.Add(instance);
        }

        entourageNormalAbility = new AbilityInstance(_info.NormalSkill, 1, entourage, null);
        AttackDiffTime         = entourageNormalAbility.AbilityCD;
    }
Ejemplo n.º 4
0
 protected virtual void EnterAwakeState(fsm.State _from, fsm.State _to, fsm.Event _event)
 {
     if (thisPlayer == null)
     {
         thisPlayer = this.gameObject.GetComponent <MainEntourage>();
     }
     if (owner == null)
     {
         owner = GameCenter.curMainPlayer;
     }
     if (thisPlayer == null)
     {
         GameSys.LogError("找不到组件!");
     }
     else
     {
         commandMng = thisPlayer.commandMng;
     }
     GameCenter.abilityMng.OnMainPlayerUseAbility += OnMainPlayerUseAbility;
     GameCenter.abilityMng.OnMainPlayerBeHit      += OnMainPlayerBeHit;
     curEventType       = EventType.AWAKE;
     startNoTargetTime  = Time.time;
     startCheakNoTarget = true;
 }