Example #1
0
    public void OnTrainAttributeFinish()
    {
        m_CurTime = -1F;
        m_Time    = -1F;
        CSMain.Instance.RemoveCounter(m_Counter);
        if (PeGameMgr.IsMulti)
        {
            return;
        }
        //1.get the top attribute
        AttribType mType;

        csp_instructorNpc = m_Creator.GetNpc(InstructorNpcId);
        csp_traineeNpc    = m_Creator.GetNpc(TraineeNpcId);
        if (csp_instructorNpc.IsRandomNpc)
        {
            mType = AttPlusNPCData.GetRandMaxAttribute(csp_instructorNpc.m_Npc.entityProto.protoId, csp_instructorNpc.m_Npc.GetCmpt <SkAliveEntity>());
        }
        else
        {
            mType = AttPlusNPCData.GetProtoMaxAttribute(csp_instructorNpc.m_Npc.entityProto.protoId, csp_instructorNpc.m_Npc.GetCmpt <SkAliveEntity>());
        }
        //2.count attribute
        AttPlusNPCData.AttrPlus.RandomInt randomInt = new AttPlusNPCData.AttrPlus.RandomInt();
        AttPlusNPCData.GetRandom(csp_instructorNpc.m_Npc.entityProto.protoId, mType, out randomInt);
        float value = new System.Random().Next(randomInt.m_Min, randomInt.m_Max + 1);

        //3.apply skill
        Debug.LogError("Train sucess: " + mType.ToString() + ":" + value);
        csp_traineeNpc.UpgradeAttribute(mType, value);

        SetNpcIsTraining(false);
        SetStopBtn(false);
        LockUI(false);
        UpdateUI();
    }