Exemplo n.º 1
0
    // Player Unit Creation Functions
    public PlayerUnit CreatePlayerUnit(PlayerUnitRank rank, UnitClass unitClass)
    {
        // Create player unit object
        Transform  playerUnitPrefab = GetPlayerUnitPrefabFromUnitClass(unitClass);
        PlayerUnit playerUnit       = Instantiate(playerUnitPrefab, playerUnitSpawnLocation).GetComponent <PlayerUnit>();

        // Initialize player unit data
        PlayerUnitData playerUnitData = unitFactory.CreatePlayerUnitData(rank, unitClass);

        playerUnit.InitializePlayerUnitGameObject(playerUnitData);

        // Prevent Stacking on Spawn
        MovePlayerUnitToOffset(playerUnit);

        // Check Achievement on every player unit creation
        GameEngine.GetInstance().achievementManager.CheckAchievementsForPlayerUnitCreation();

        // Display message
        MessageType msgType = MessageType.INFO;

        if (playerUnit.GetPlayerUnitData().GetRank() == PlayerUnitRank.S || playerUnit.GetPlayerUnitData().GetRank() == PlayerUnitRank.X)
        {
            msgType = MessageType.POSITIVE;
        }
        GameEngine.GetInstance().messageQueue.PushMessage("[" + playerUnit.GetPlayerUnitData().GetRank() + " Rank Unit] " + Utils.CleanEnumString(playerUnit.GetPlayerUnitData().GetUnitClass().ToString()), msgType);

        // Sound Effect
        GameEngine.GetInstance().audioManager.PlayAudio(AudioManager.PLAYER_UNIT_CREATION_SOUND);

        return(playerUnit);
    }
    /// <summary>
    /// The way the saving works is that when a map is won, it will create new units inside the "SavedData" scriptable object.
    /// Since we are resetting all the player stats and only keeping the Equipment, we can instantiate new units completely and
    /// simply "transfer" the equipment of the unit into the new unit created in the SavedData scriptable object.
    /// </summary>
    public void SavePlayerUnits()
    {
        ClearSavedData();

        foreach (KeyValuePair <Vector3Int, Unit> item in UnitManager.Instance.unitDictionnary)
        {
            if (item.Value is PlayerUnit)
            {
                PlayerUnitData oldPlayerUnitData = item.Value.unitData as PlayerUnitData;

                PlayerUnitData newPlayerUnitData = Resources.Load <PlayerUnitData>(SCRIPTABLE_UNITS_PATH + oldPlayerUnitData.name).Clone();
                Equipment      newEquipment      = new Equipment();

                if (oldPlayerUnitData.equipment.mainHand != null)
                {
                    newEquipment.mainHand = Resources.Load <Weapon>(SCRIPTABLE_ITEMS_PATH + oldPlayerUnitData.equipment.mainHand.name).Clone();
                }

                if (oldPlayerUnitData.equipment.body != null)
                {
                    newEquipment.body = Resources.Load <Armor>(SCRIPTABLE_ITEMS_PATH + oldPlayerUnitData.equipment.body.name).Clone();
                }

                newPlayerUnitData.equipment = newEquipment;
                savedData.playerUnits.Add(newPlayerUnitData);
            }
        }
    }
Exemplo n.º 3
0
    //< 유닛 스폰
    private GameObject SpawnPc(byte teamID, PlayerUnitData unitSyncData, bool isPartner = false)
    {
        Vector3    spawnPos = transform.position;
        Quaternion spawnRot = transform.rotation;

        ////게임 인포를 통한 유닛 생성
        return(G_GameInfo.GameInfo.SpawnUnit(this.AccountUUID, teamID, unitSyncData, spawnPos, spawnRot, isPartner));
    }
Exemplo n.º 4
0
    public void ChangeHead(GameObject target)
    {
        if (target == null || target.GetComponent <Unit>() == null)
        {
            return;
        }

        Owner = target.GetComponent <Unit>();

        // 여기서 이름,체력바 제한을..?
        bool nameActive = true;
        bool barActive  = true;

        char[] showNameArr = SceneManager.instance.optionData.ShowName.ToCharArray();
        char[] showBarArr  = SceneManager.instance.optionData.ShowHpBar.ToCharArray();

        //bar
        if (IsMy)//|| Owner.IsPartner
        {
            //나
            barActive  = showBarArr[1].Equals('1') ? false : true;
            nameActive = showNameArr[1].Equals('1') ? false : true;
        }
        else
        {
            byte teamID    = 0;
            int  teamCount = NetData.instance._playerSyncData.playerSyncDatas.Count;

            for (int i = 0; i < teamCount; i++)
            {
                PlayerUnitData teamData = NetData.instance._playerSyncData.playerSyncDatas[i];
                if (teamData._TCPUUID != 0)
                {
                    continue;
                }

                teamID = teamData._TeamID;
                break;
            }


            if (Owner.TeamID == teamID)//파티원??
            {
                barActive = showBarArr[2].Equals('1') ? false : true;
            }
            else
            {
                barActive = showBarArr[3].Equals('1') ? false : true;
            }

            nameActive = showNameArr[2].Equals('1') ? false : true;
        }

        HpSlider.transform.gameObject.SetActive(barActive);
        ArmorSlider.transform.gameObject.SetActive(barActive);
        NickName.transform.parent.gameObject.SetActive(nameActive);
    }
Exemplo n.º 5
0
    /// <summary>
    /// NetworkView로 부터 받아온 초기화 데이터들을 셋팅하도록 한다.
    /// </summary>
    protected override void Init_SyncData(params object[] args)
    {
        base.Init_SyncData(args);

        //syncData = (UnitSyncData)args[3];
        syncData = (PlayerUnitData)args[3];

        AttackType = 1;// LowDataMgr.GetUnitAbilityData(syncData.LowID).attackType;
    }
Exemplo n.º 6
0
    /// 컨트롤러 초기화 (플레이어에 필요한 Pc, Units 생성)
    public void Init(PlayerUnitData _playerData, List <PlayerUnitData> partnerList)
    {
        NpcKillCount = 0;
        unitSyncData = _playerData;

        G_GameInfo.GameInfo.SetPlayerCtrl(this);

        //ComboAfterApplyCount = (int)LowDataMgr.GetConfigValue( "ComboAfterApplyCount" );
        ComboTieCheckTime = 0;                 // LowDataMgr.GetConfigValue( "ComboTieCheckTime" ) / GameDefine.ConvertMilliToSec;

        Combat_Friend_Time = 0;                // LowDataMgr.GetConfigValue( "Combat_Friend_Time" );
        Combat_Friend_UnitRecall_CoolTime = 0; //LowDataMgr.GetConfigValue( "Combat_Friend_UnitRecall_CoolTime" );
        Combat_Friend_LimitCount          = 0; //(int)LowDataMgr.GetConfigValue( "Combat_Friend_Count" );
        friendSummonCount = 0;

        // 내 유닛리스트 생성
        Unit leader = SpawnPc(unitSyncData._TeamID, unitSyncData).GetComponent <Unit>();

        leader.m_rUUID = NetData.instance._userInfo._charUUID;

        //내유닛이 avoidancePriority 늘려준다(못밀게)
        leader.navAgent.avoidancePriority = 40;

        if (G_GameInfo.GameInfo.GameMode != GAME_MODE.FREEFIGHT)
        {
            if (partnerList != null)
            {
                int count = 0;
                for (int i = 0; i < partnerList.Count; i++)
                {
                    if (unitSyncData._TeamID == partnerList[i]._TeamID)
                    {
                        Unit partner = SpawnPartner(partnerList[i]._TeamID, partnerList[i], leader, count).GetComponent <Unit>();
                        partner.m_rUUID = partnerList[i]._TCPUUID;
                        G_GameInfo.CharacterMgr.AddRoomUnit(partner);

                        count++;
                    }
                }
            }
        }

        Leader = Units[0];

        G_GameInfo.CharacterMgr.AddRoomUnit(leader);     //빠른 검색을 위한 리스트 추가...

        if (SceneManager.instance.IsRTNetwork)
        {
            if (!G_GameInfo.CharacterMgr.allTeamDic.ContainsKey(1))
            {
                G_GameInfo.CharacterMgr.allTeamDic.Add(1, new List <Unit>());
            }
        }
    }
Exemplo n.º 7
0
    //---------- Methods ----------
    public void InitializePlayerUnitGameObject(PlayerUnitData playerUnitData)
    {
        SetPlayerUnitData(playerUnitData);

        UnitSpawner.SetObjectName(gameObject);

        // Rank Indication
        RankIndicatorBar rankIndicatorBar = GetComponentInChildren <RankIndicatorBar>();

        rankIndicatorBar.Initialize(GetPlayerUnitData().GetRank());

        // Create range circle
        CreatePlayerUnitRangeCircle();
    }
Exemplo n.º 8
0
    public PlayerUnitData CreatePlayerUnitData(PlayerUnitRank rank, int selection)
    {
        UnitClass unitClass = ConvertIntegerToUnitClass(selection);

        if (unitClass == UnitClass.MAGIC || unitClass == UnitClass.FLAME)
        {
            if (rank == PlayerUnitRank.D || rank == PlayerUnitRank.C)
            {
                throw new GameplayException("Cannot create player unit data object. Invalid combination for rank and selection: " + rank + " " + selection);
            }
        }

        PlayerUnitData playerUnitData = CreatePlayerUnitData(rank, unitClass);

        return(playerUnitData);
    }
        protected override void DrawPropertyLayout(GUIContent label)
        {
            var rect = EditorGUILayout.GetControlRect(label != null, 45);

            rect = EditorGUI.IndentedRect(rect);

            PlayerUnitData playerUnit = ValueEntry.SmartValue;
            Texture        texture    = null;

            if (playerUnit)
            {
                texture = GUIHelper.GetAssetThumbnail(playerUnit.icon, typeof(TPlayerUnitData), true);
                GUI.Label(rect.AddXMin(50).AlignMiddle(16), EditorGUI.showMixedValue ? "-" : playerUnit.Name + "  " +
                          $"[ AP:{playerUnit.stats.Ap} HP:{playerUnit.stats.Hp} DMG:{playerUnit.stats.Dmg} DEF:{playerUnit.stats.Def} ]");
            }

            ValueEntry.WeakSmartValue = SirenixEditorFields.UnityPreviewObjectField(rect.AlignLeft(45), playerUnit, texture, ValueEntry.BaseValueType);
        }
Exemplo n.º 10
0
    /// <summary>
    /// 파트너 스폰
    /// </summary>
    private GameObject SpawnPartner(byte teamID, PlayerUnitData unitSyncData, Unit leader, int idx = 0)
    {
        //따라다닐 더미 생성해서 leader에 붙이고 더미를 타겟으로 넣게 수정
        Unit DummyUnit = new GameObject().AddComponent <Unit>();

        DummyUnit.gameObject.name = string.Format("DummyUnit_{0}", idx);
        Transform dummyTr = DummyUnit.gameObject.transform;

        dummyTr.parent = leader.transform;
        dummyTr.transform.localScale = Vector3.one;

        Vector3    spawnPos = transform.position + (idx == 0 ? new Vector3(1.5f, 0, -1.5f) : new Vector3(-1.5f, 0, -1.5f));
        Quaternion spawnRot = transform.rotation;

        dummyTr.transform.position = spawnPos;

        ////게임 인포를 통한 유닛 생성
        return(G_GameInfo.GameInfo.SpawnPartner(this.AccountUUID, teamID, unitSyncData, spawnPos, spawnRot, true, DummyUnit));
    }
Exemplo n.º 11
0
    // Read in player unit data
    private void InitializePlayerUnitData()
    {
        playerUnitData = new Dictionary <PlayerUnitRank, Dictionary <UnitClass, PlayerUnitData> > {
            { PlayerUnitRank.D, new Dictionary <UnitClass, PlayerUnitData>() },
            { PlayerUnitRank.C, new Dictionary <UnitClass, PlayerUnitData>() },
            { PlayerUnitRank.B, new Dictionary <UnitClass, PlayerUnitData>() },
            { PlayerUnitRank.A, new Dictionary <UnitClass, PlayerUnitData>() },
            { PlayerUnitRank.S, new Dictionary <UnitClass, PlayerUnitData>() },
            { PlayerUnitRank.X, new Dictionary <UnitClass, PlayerUnitData>() }
        };

        PlayerUnitRank rank;
        string         displayName;
        UnitClass      unitClass;
        AttackType     attackType;
        float          movementSpeed;
        float          attackDamage;
        float          attackUpgrade;
        float          attackCooldown;
        float          attackRange;

        int       lineIndex  = 0;
        TextAsset playerData = Resources.Load <TextAsset>(PLAYER_UNIT_DATA_PATH);

        string[] lines = playerData.text.Split('\n');

        foreach (string line in lines)
        {
            if (lineIndex == 0)
            {
                lineIndex++;
                continue;   // skip file header
            }

            string[] lineTokens = line.Trim().Split(',');
            if (lineTokens.Length <= 1)
            {
                lineIndex++;
                continue;
            }

            rank           = ConvertPlayerUnitRankString(lineTokens[0]);
            displayName    = lineTokens[1];
            unitClass      = ConvertUnitClassString(lineTokens[2]);
            attackType     = ConvertAttackTypeString(lineTokens[3]);
            movementSpeed  = float.Parse(lineTokens[4]);
            attackDamage   = float.Parse(lineTokens[5]);
            attackUpgrade  = float.Parse(lineTokens[6]);
            attackCooldown = float.Parse(lineTokens[7]);
            attackRange    = float.Parse(lineTokens[8]);

            PlayerUnitData playerUnitData = new PlayerUnitData(displayName,
                                                               unitClass,
                                                               movementSpeed,
                                                               rank,
                                                               attackDamage,
                                                               attackUpgrade,
                                                               attackCooldown,
                                                               attackRange,
                                                               attackType);
            this.playerUnitData[rank].Add(unitClass, playerUnitData);

            lineIndex++;
        }
        Debug.Log("Finished reading player unit data. Read: [" + (lineIndex + 1) + "] number of lines.");
    }
Exemplo n.º 12
0
    public virtual bool PattenUpdate()
    {
        bool isPatten = false;
        int  count    = PattenList.Count;

        for (int i = 0; i < count; i++)
        {
            bool       isAction = false;
            PattenData data     = PattenList[i];
            float      value    = data.PattenValue;

            switch (data.PaType)
            {
            case PattenType.TimeLater:     //소환된 후 시간
                value = value * 0.01f;     //100 == 1
                if (value <= data.RunTime) //발동 조건
                {
                    isAction = true;
                }

                break;

            case PattenType.MyHp:     //현재 체력
            {
                value = value * 0.1f; //10 == 1
                float con = parent.CharInfo.Hp / parent.CharInfo.MaxHp;
                if (data.ConType == ConditionType.Over)
                {
                    if (value <= con)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (con < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }
            break;

            case PattenType.EnemyTotalHp:    //적의 총 체력 평균
            {
                int totalHp = 0, totalMaxHp = 0;
                int playerCount = NetData.instance._playerSyncData.playerSyncDatas.Count;
                for (int j = 0; j < playerCount; j++)
                {
                    PlayerUnitData unitData = NetData.instance._playerSyncData.playerSyncDatas[j];
                    Unit           unit     = G_GameInfo.CharacterMgr.FindRoomUnit(unitData._AccountUUID);
                    totalHp    += unit.CharInfo.Hp;
                    totalMaxHp += unit.CharInfo.MaxHp;
                }

                int parCount = NetData.instance._playerSyncData.partnerSyncDatas.Count;
                for (int j = 0; j < parCount; j++)
                {
                    PlayerUnitData parData = NetData.instance._playerSyncData.partnerSyncDatas[i];
                    Unit           unit    = G_GameInfo.CharacterMgr.FindRoomUnit(parData._AccountUUID);
                    totalHp    += unit.CharInfo.Hp;
                    totalMaxHp += unit.CharInfo.MaxHp;
                }

                value = value * 0.1f;        //10 == 1
                float con = totalHp / totalMaxHp;
                if (data.ConType == ConditionType.Over)
                {
                    if (value <= con)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (con < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }
            break;

            case PattenType.LifeCount:    //팀의 살아있는 수 <- 몬스터
            {
                int teamLiveCount = 0;

                int teamCount = NetData.instance._playerSyncData.playerSyncDatas.Count;
                for (int j = 0; j < teamCount; j++)
                {
                    PlayerUnitData teamData = NetData.instance._playerSyncData.playerSyncDatas[i];
                    if (teamData._TeamID == parent.TeamID)           //같은편
                    {
                        Unit unit = G_GameInfo.CharacterMgr.FindRoomUnit(teamData._AccountUUID);
                        if (!unit.IsDie)         //살아있따
                        {
                            teamLiveCount++;
                        }
                    }
                }
                int parCount = NetData.instance._playerSyncData.partnerSyncDatas.Count;
                for (int j = 0; j < parCount; j++)
                {
                    PlayerUnitData parData = NetData.instance._playerSyncData.partnerSyncDatas[i];
                    if (parData._TeamID == parent.TeamID)            //같은편
                    {
                        Unit unit = G_GameInfo.CharacterMgr.FindRoomUnit(parData._AccountUUID);
                        if (!unit.IsDie)         //살아있따
                        {
                            teamLiveCount++;
                        }
                    }
                }

                if (data.ConType == ConditionType.Over)
                {
                    if (value <= teamLiveCount)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (teamLiveCount < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }

            break;

            case PattenType.EnemyLifeCount:    //적의 살아있는 수
            {
                int liveCount   = 0;
                int playerCount = NetData.instance._playerSyncData.playerSyncDatas.Count;
                for (int j = 0; j < playerCount; j++)
                {
                    PlayerUnitData unitData = NetData.instance._playerSyncData.playerSyncDatas[j];
                    Unit           unit     = G_GameInfo.CharacterMgr.FindRoomUnit(unitData._AccountUUID);
                    if (!unit.IsDie)            //살았다
                    {
                        liveCount++;
                    }
                }

                int parCount = NetData.instance._playerSyncData.partnerSyncDatas.Count;
                for (int j = 0; j < parCount; j++)
                {
                    PlayerUnitData parData = NetData.instance._playerSyncData.partnerSyncDatas[i];
                    Unit           unit    = G_GameInfo.CharacterMgr.FindRoomUnit(parData._AccountUUID);
                    if (!unit.IsDie)            //살았다
                    {
                        liveCount++;
                    }
                }

                if (data.ConType == ConditionType.Over)
                {
                    if (value <= liveCount)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (liveCount < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }
            break;

            case PattenType.EnemyDeadCount:    //적의 죽어있는 수
            {
                int deadCount   = 0;
                int playerCount = NetData.instance._playerSyncData.playerSyncDatas.Count;
                for (int j = 0; j < playerCount; j++)
                {
                    PlayerUnitData unitData = NetData.instance._playerSyncData.playerSyncDatas[j];
                    Unit           unit     = G_GameInfo.CharacterMgr.FindRoomUnit(unitData._AccountUUID);
                    if (unit.IsDie)            //죽었다
                    {
                        deadCount++;
                    }
                }

                int parCount = NetData.instance._playerSyncData.partnerSyncDatas.Count;
                for (int j = 0; j < parCount; j++)
                {
                    PlayerUnitData parData = NetData.instance._playerSyncData.partnerSyncDatas[i];
                    Unit           unit    = G_GameInfo.CharacterMgr.FindRoomUnit(parData._AccountUUID);
                    if (unit.IsDie)            //죽었다
                    {
                        deadCount++;
                    }
                }

                if (data.ConType == ConditionType.Over)
                {
                    if (value <= deadCount)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (deadCount < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }
            break;

            case PattenType.DeadCount:    //팀의 죽어있는 수 <- 몬스터
            {
                int teamDeadCount = 0;

                int teamCount = NetData.instance._playerSyncData.playerSyncDatas.Count;
                for (int j = 0; j < teamCount; j++)
                {
                    PlayerUnitData teamData = NetData.instance._playerSyncData.playerSyncDatas[i];
                    if (teamData._TeamID == parent.TeamID)           //같은편
                    {
                        Unit unit = G_GameInfo.CharacterMgr.FindRoomUnit(teamData._AccountUUID);
                        if (unit.IsDie)          //죽었다
                        {
                            teamDeadCount++;
                        }
                    }
                }
                int parCount = NetData.instance._playerSyncData.partnerSyncDatas.Count;
                for (int j = 0; j < parCount; j++)
                {
                    PlayerUnitData parData = NetData.instance._playerSyncData.partnerSyncDatas[i];
                    if (parData._TeamID == parent.TeamID)            //같은편
                    {
                        Unit unit = G_GameInfo.CharacterMgr.FindRoomUnit(parData._AccountUUID);
                        if (unit.IsDie)         //죽었다
                        {
                            teamDeadCount++;
                        }
                    }
                }

                if (data.ConType == ConditionType.Over)
                {
                    if (value <= teamDeadCount)        //발동 조건
                    {
                        isAction = true;
                    }
                }
                else if (data.ConType == ConditionType.Under)
                {
                    if (teamDeadCount < value)        //발동 조건
                    {
                        isAction = true;
                    }
                }
            }

            break;
            }

            if (!isAction)//발동 조건 미흡
            {
                continue;
            }

            switch (data.AcType)
            {
            //case ActionType.MovePoint ://보류 조건
            //Transform movePos = null;
            //if(PattenPosDic.TryGetValue(data.ActionValue, out movePos))
            //{
            //    isPatten = parent.MovePosition(movePos.position);
            //    if (isPatten)
            //        Debug.Log("<color=yellow>Patten success skill id </color>" + data.ActionValue);
            //}

            //break;

            case ActionType.Skill:
                for (int j = 0; j < parent.SkillCtlr.SkillList.Length; j++)
                {
                    Skill sk = parent.SkillCtlr.SkillList[j];
                    if (sk == null || !sk.IsPatten || sk.GetSkillIndex() != data.ActionValue)
                    {
                        continue;
                    }

                    isPatten = parent.UseSkill(j);
                    if (isPatten)
                    {
                        Debug.Log("<color=yellow>Patten success skill id </color>" + data.ActionValue);
                    }
                    break;
                }

                //isPatten = UseSkill(data.ActionValue);
                break;

            case ActionType.Spawn:
                isPatten = G_GameInfo.GameInfo.spawnCtlr.MenualSpawnGroup((int)data.ActionValue);
                if (isPatten)
                {
                    Debug.Log("<color=yellow>Patten success Spawn Group id </color>" + data.ActionValue);
                    PattenList.Remove(data);    //소환 성공했으니 해당 데이터 더 이상 사용하지 않는다. 추후에는 변경될지도 모름.
                }
                break;
            }

            if (isPatten)
            {
                break;
            }
        }

        return(isPatten);
    }
Exemplo n.º 13
0
    public PlayerUnitData MakeEnemySyncData(ulong uuID, string nick, uint charIdx, uint level, uint vipLv, int att, uint costumeIdx
                                            , bool isHideCostume, List <int> equipIdxList, List <_PartnerData> parList, uint prefix, uint suffix, uint skillSetId)
    {
        PlayerUnitData   enemyData = new PlayerUnitData();
        List <_ItemData> equipList = new List <_ItemData>();
        uint             HELMETID  = 0;
        uint             CLOTHID   = 0;
        uint             WEAPONID  = 0;

        for (int i = 0; i < equipIdxList.Count; i++)
        {
            Item.EquipmentInfo equipInfo = _LowDataMgr.instance.GetLowDataEquipItemInfo((uint)equipIdxList[i]);
            if (equipInfo == null)
            {
                continue;
            }

            switch ((ePartType)equipInfo.Type)
            {
            case ePartType.CLOTH:
                CLOTHID = equipInfo.Id;
                break;

            case ePartType.HELMET:
                HELMETID = equipInfo.Id;
                break;

            case ePartType.WEAPON:
                WEAPONID = equipInfo.Id;
                break;
            }

            equipList.Add(new _ItemData((ulong)equipIdxList[i], (uint)equipIdxList[i], 0, equipInfo.Grade, 0, 0));
        }

        ushort[] skillLevel = new ushort[] {        //스킬의 레벨을 현재는 알 수 없다. 1로 강제지정한다.
            1, 1, 1, 1, 1
        };
        Dictionary <AbilityType, float> playerStats = CalcPlayerStats(charIdx, level, equipList, new _CostumeData((ulong)costumeIdx, (uint)costumeIdx, 1, 0, skillLevel, true, true));

        if (isHideCostume)
        {
        }
        else
        {
        }

        //Item.CostumeInfo costumeData = _LowDataMgr.instance.GetLowDataCostumeInfo(costumeIdx);
        //서버에서 정상적인 데이터 오기전까지는 일렇게.
        if (skillSetId <= 0)
        {
            switch (charIdx)
            {
            case 11000:
                skillSetId = 100;
                break;

            case 12000:
                skillSetId = 200;
                break;

            case 13000:
                skillSetId = 300;
                break;
            }
        }
        enemyData.Init(0,
                       (int)eTeamType.Team2,
                       nick,
                       uuID,
                       uuID,
                       charIdx,
                       HELMETID,
                       costumeIdx,
                       CLOTHID,
                       WEAPONID,
                       skillSetId,
                       isHideCostume,
                       level,
                       prefix,
                       suffix,
                       playerStats);

        uint skillIndex = 0;

        SkillTables.SkillSetInfo setInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
        for (int i = 0; i < setInfo.skill0.Count; i++)
        {
            uint.TryParse(setInfo.skill0[i], out skillIndex);
            enemyData.NormalAttackData[i] = new SkillData(skillIndex, (byte)skillLevel[0]);
        }

        enemyData.SkillData[0] = new SkillData(setInfo.skill1, (byte)1);
        enemyData.SkillData[1] = new SkillData(setInfo.skill2, (byte)1);
        enemyData.SkillData[2] = new SkillData(setInfo.skill3, (byte)1);
        enemyData.SkillData[3] = new SkillData(setInfo.skill4, (byte)1);

        for (int i = 0; i < setInfo.Chain.Count; i++)
        {
            uint.TryParse(setInfo.Chain[i], out skillIndex);
            enemyData.SkillData[4 + i] = new SkillData(skillIndex, (byte)skillLevel[1]);
        }
        _playerSyncData.playerSyncDatas.Add(enemyData);

        for (int i = 0; i < parList.Count; i++)
        {
            _PartnerData partner = parList[i];

            if (partner != null)
            {
                Partner.PartnerDataInfo partnerInfo = partner.GetLowData();
                if (partnerInfo == null)                //테이블 변경으로 서버에서 가지고 있는 데이터와 다를 수 있다.
                {
                    Debug.LogWarning("not found partner lowData error " + partner._partnerDataIndex);
                    continue;
                }

                Dictionary <AbilityType, float> partnerStats = CalcPartnerStats(partner._NowLevel, partnerInfo, partnerInfo.Quality /*, partner._MinorGrade, partner._Enchant*/);

                PlayerUnitData partnerData = new PlayerUnitData();
                partnerData.Init((byte)(i + 1),
                                 (byte)eTeamType.Team2,
                                 partner.GetLocName(),                //"Partner0",
                                 2 + (ulong)i,
                                 2 + (ulong)i,
                                 partner._partnerDataIndex,
                                 partner._NowLevel,
                                 partnerStats);

                partnerData.NormalAttackData[0] = new SkillData(partnerInfo.skill0, 1);
                partnerData.SkillData[0]        = new SkillData(partnerInfo.skill1, 1);
                partnerData.SkillData[1]        = new SkillData(partnerInfo.skill2, 1);
                partnerData.SkillData[2]        = new SkillData(partnerInfo.skill3, 1);
                partnerData.SkillData[3]        = new SkillData(partnerInfo.skill4, 1);

                //파트너 버프 삭제
                //if (partner.GetBuffSkillToSlot(0) != null)
                //	if (partner.GetBuffSkillToSlot(0)._skillIndex != 0)
                //		partnerData.PassiveBuff[0] = new SkillData(partner.GetBuffSkillToSlot(0)._skillIndex, (byte)partner.GetBuffSkillToSlot(0)._skillLevel);

                //if (partner.GetBuffSkillToSlot(1) != null)
                //	if (partner.GetBuffSkillToSlot(1)._skillIndex != 0)
                //		partnerData.PassiveBuff[1] = new SkillData(partner.GetBuffSkillToSlot(1)._skillIndex, (byte)partner.GetBuffSkillToSlot(1)._skillLevel);

                //if (partner.GetBuffSkillToSlot(2) != null)
                //	if (partner.GetBuffSkillToSlot(2)._skillIndex != 0)
                //		partnerData.PassiveBuff[2] = new SkillData(partner.GetBuffSkillToSlot(2)._skillIndex, (byte)partner.GetBuffSkillToSlot(2)._skillLevel);

                //if (partner.GetBuffSkillToSlot(3) != null)
                //	if (partner.GetBuffSkillToSlot(3)._skillIndex != 0)
                //		partnerData.PassiveBuff[3] = new SkillData(partner.GetBuffSkillToSlot(3)._skillIndex, (byte)partner.GetBuffSkillToSlot(3)._skillLevel);

                _playerSyncData.partnerSyncDatas.Add(partnerData);
            }
        }

        return(enemyData);
    }
Exemplo n.º 14
0
    public _PlayerSyncData OtherPcSyncData(ulong AccountUUID, ulong a_rUUID, string a_Nick, uint a_CharIdx, uint a_userCostumeIdx, uint a_userLevel, uint prefix, uint suffix, uint maxSuperArmor, uint skillSetId)
    {
        _PlayerSyncData otherPcSyncData = new _PlayerSyncData();
        //if (_playerSyncData == null)
        //    return;

        PlayerUnitData myData = new PlayerUnitData();

        Dictionary <AbilityType, float> playerStats = new Dictionary <AbilityType, float>();

        //기본 스탯 넣어주자
        uint iLevel = 1;

        //일단 기본캐릭만
        Character.CharacterInfo charInfo = _LowDataMgr.instance.GetCharcterData(11000);
        playerStats.Add(AbilityType.HP, (float)(charInfo.BaseHp + iLevel * _LowDataMgr.instance.GetFormula(FormulaType.LEVELUP_CALIBRATION, 1) * charInfo.LevelUpHp));
        playerStats.Add(AbilityType.DAMAGE, (float)(charInfo.BaseAtk + iLevel * _LowDataMgr.instance.GetFormula(FormulaType.LEVELUP_CALIBRATION, 1) * charInfo.LevelUpAtk));
        playerStats.Add(AbilityType.HIT_RATE, (float)(charInfo.BaseHit * 0.1f + iLevel * _LowDataMgr.instance.GetFormula(FormulaType.LEVELUP_CALIBRATION, 1) * charInfo.LevelHitRate));
        playerStats.Add(AbilityType.DODGE_RATE, (float)(charInfo.BaseAvoid * 0.1f + iLevel * _LowDataMgr.instance.GetFormula(FormulaType.LEVELUP_CALIBRATION, 1) * charInfo.LevelAvoidRate));
        playerStats.Add(AbilityType.CRITICAL_RATE, (float)(charInfo.BaseCriticalRate * 0.1f));
        playerStats.Add(AbilityType.CRITICAL_RES, (float)(charInfo.BaseCriticalResist * 0.1f));
        playerStats.Add(AbilityType.CRITICAL_DAMAGE, (float)(charInfo.BaseCriticalDamage * 0.1f));
        playerStats.Add(AbilityType.DRAIN_HP, (float)(charInfo.BaseLifeSteal * 0.1f));
        playerStats.Add(AbilityType.DEFENCE_IGNORE, (float)(charInfo.BaseIgnoreAtk));
        playerStats.Add(AbilityType.DAMAGE_DECREASE, (float)(charInfo.BaseDamageDown));
        playerStats.Add(AbilityType.DAMAGE_DECREASE_RATE, (float)(charInfo.BaseDamageDownRate * 0.1f));
        playerStats.Add(AbilityType.EXP_UP, 0f);
        playerStats.Add(AbilityType.ALLSTAT_RATE, 0f);
        playerStats.Add(AbilityType.SUPERARMOR, maxSuperArmor);
        playerStats.Add(AbilityType.SUPERARMOR_RECOVERY, (float)(charInfo.SuperArmorRecovery));
        playerStats.Add(AbilityType.SUPERARMOR_RECOVERY_RATE, (float)(charInfo.SuperArmorRecoveryRate));
        playerStats.Add(AbilityType.SUPERARMOR_RECOVERY_TIME, (float)(charInfo.SuperArmorRecoveryTime));

        /*
         * for (int i = 0; i < (int)ePartType.PART_MAX; i++)
         * _ItemData equipItem = GetUserInfo().GetEquipParts((ePartType)i);
         *
         * if (equipItem != null)
         * {
         * var enumerator = equipItem.Stats.GetEnumerator();
         * while (enumerator.MoveNext())
         * {
         *  if (playerStats.ContainsKey(enumerator.Current.Key))
         *  {
         *      //있는거면 더해주기
         *      playerStats[enumerator.Current.Key] += RealValue(enumerator.Current.Key, enumerator.Current.Value);
         *  }
         *  else
         *  {
         *      //없는거면 추가
         *      playerStats.Add(enumerator.Current.Key, RealValue(enumerator.Current.Key, enumerator.Current.Value));
         *  }
         *
         * }
         * }
         * }
         */

        uint HELMETID = 0;
        uint CLOTHID  = 0;
        uint WEAPONID = 0;

        Item.EquipmentInfo tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.HELMET);
        if (tempInfo == null)
        {
            HELMETID = 0;
        }
        else
        {
            HELMETID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.CLOTH);
        if (tempInfo == null)
        {
            CLOTHID = 0;
        }
        else
        {
            CLOTHID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.WEAPON);
        if (tempInfo == null)
        {
            WEAPONID = 0;
        }
        else
        {
            WEAPONID = tempInfo.Id;
        }

        //서버에서 정상적인 데이터 오기전까지는 일렇게.
        if (skillSetId <= 0)
        {
            switch (a_CharIdx)
            {
            case 11000:
                skillSetId = 100;
                break;

            case 12000:
                skillSetId = 200;
                break;

            case 13000:
                skillSetId = 300;
                break;
            }
        }

        myData.Init(0,
                    0,
                    a_Nick,
                    AccountUUID,
                    a_rUUID,
                    a_CharIdx,
                    0,
                    a_userCostumeIdx,
                    0,
                    0,
                    skillSetId,
                    false,
                    1,
                    prefix,
                    suffix,
                    playerStats);

        //Item.CostumeInfo costumeData = _LowDataMgr.instance.GetLowDataCostumeInfo(a_userCostumeIdx);

        uint skillIndex = 0;

        SkillTables.SkillSetInfo setInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
        for (int i = 0; i < setInfo.skill0.Count; i++)
        {
            uint.TryParse(setInfo.skill0[i], out skillIndex);
            myData.NormalAttackData[i] = new SkillData(skillIndex, (byte)1);
        }

        myData.SkillData[0] = new SkillData(setInfo.skill1, (byte)1);
        myData.SkillData[1] = new SkillData(setInfo.skill2, (byte)1);
        myData.SkillData[2] = new SkillData(setInfo.skill3, (byte)1);
        myData.SkillData[3] = new SkillData(setInfo.skill4, (byte)1);

        for (int i = 0; i < setInfo.Chain.Count; i++)
        {
            uint.TryParse(setInfo.Chain[i], out skillIndex);
            myData.SkillData[4 + i] = new SkillData(skillIndex, (byte)1);
        }

        otherPcSyncData.playerSyncDatas.Add(myData);

        return(otherPcSyncData);
    }
Exemplo n.º 15
0
    public void MakePlayerSyncData(bool bMakePartnerData)
    {
        //내 플레이어용 싱크데이터
        _playerSyncData = null;
        _playerSyncData = new _PlayerSyncData();

        PlayerUnitData myData = new PlayerUnitData();

        _playerSyncData.Init();

        Dictionary <AbilityType, float> playerStats = CalcPlayerStats();

        uint HELMETID = 0;
        uint CLOTHID  = 0;
        uint WEAPONID = 0;

        Item.EquipmentInfo tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.HELMET);
        if (tempInfo == null)
        {
            HELMETID = 0;
        }
        else
        {
            HELMETID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.CLOTH);
        if (tempInfo == null)
        {
            CLOTHID = 0;
        }
        else
        {
            CLOTHID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.WEAPON);
        if (tempInfo == null)
        {
            WEAPONID = 0;
        }
        else
        {
            WEAPONID = tempInfo.Id;
        }

        ushort[] skillLevel     = null;
        uint     equipCostumeId = 0;

        if (GetUserInfo().GetEquipCostume() == null)
        {
            Newbie.NewbieInfo newbieinfo = _LowDataMgr.instance.GetNewbieCharacterData(GetUserInfo()._userCharIndex);
            equipCostumeId = newbieinfo.CostumIdx;

            skillLevel = new ushort[] {
                1, 1, 1, 1, 1
            };
        }
        else
        {
            equipCostumeId = GetUserInfo().GetEquipCostume()._costmeDataIndex;
            skillLevel     = GetUserInfo().GetEquipCostume()._skillLevel;
        }

        SkillSetData skillSetData = GetUserInfo().GetEquipSKillSet();
        uint         skillSetId   = 0;

        uint[] skillIds = new uint[4];
        uint[] skillLv  = new uint[4];

        if (skillSetData == null)
        {
            switch (GetUserInfo().GetCharIdx())
            {
            case 11000:
                skillSetId = 100;
                break;

            case 12000:
                skillSetId = 200;
                break;

            case 13000:
                skillSetId = 300;
                break;
            }

            SkillTables.SkillSetInfo info = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
            skillIds[0] = info.skill1;
            skillIds[1] = info.skill2;
            skillIds[2] = info.skill3;
            skillIds[3] = info.skill4;
            for (int i = 0; i < skillLv.Length; i++)
            {
                skillLv[i] = 1;
            }
        }
        else
        {
            skillSetId = skillSetData.SkillSetId;
            for (int i = 0; i < skillIds.Length; i++)
            {
                skillIds[i] = skillSetData.SkillId[i];
                skillLv[i]  = skillSetData.SkillLevel[i];
            }
        }

        myData.Init(0,
                    (int)eTeamType.Team1,
                    Nickname,
                    AccountUUID,
                    0,
                    GetUserInfo().GetCharIdx(),
                    HELMETID,
                    equipCostumeId,
                    CLOTHID,
                    WEAPONID,
                    skillSetId,
                    GetUserInfo().isHideCostum,
                    GetUserInfo()._Level,
                    GetUserInfo()._LeftTitle,
                    GetUserInfo()._RightTitle,
                    playerStats);

        uint skillIndex = 0;

        SkillTables.SkillSetInfo setInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetId);
        for (int i = 0; i < setInfo.skill0.Count; i++)
        {
            uint.TryParse(setInfo.skill0[i], out skillIndex);
            myData.NormalAttackData[i] = new SkillData(skillIndex, (byte)skillLevel[0]);
        }

        myData.SkillData[0] = new SkillData(skillIds[0], (byte)skillLv[0]);
        myData.SkillData[1] = new SkillData(skillIds[1], (byte)skillLv[1]);
        myData.SkillData[2] = new SkillData(skillIds[2], (byte)skillLv[2]);
        myData.SkillData[3] = new SkillData(skillIds[3], (byte)skillLv[3]);

        for (int i = 0; i < setInfo.Chain.Count; i++)
        {
            uint.TryParse(setInfo.Chain[i], out skillIndex);
            myData.SkillData[4 + i] = new SkillData(skillIndex, (byte)skillLevel[1]);
        }

        _playerSyncData.playerSyncDatas.Add(myData);

        if (!bMakePartnerData)
        {
            return;
        }

        for (int i = 0; i < 2; i++)                                      //GetUserInfo().GetPartnerList().Count
        {
            _PartnerData partner = GetUserInfo().GetEquipPartner(i + 1); //슬롯 시작값이 1부터이다. i를 1부터 시작시키게 했다.

            if (partner != null)
            {
                Partner.PartnerDataInfo         partnerInfo  = partner.GetLowData();
                Dictionary <AbilityType, float> partnerStats = CalcPartnerStats(partner._NowLevel, partnerInfo, partnerInfo.Quality /*, partner._MinorGrade, partner._Enchant*/);

                PlayerUnitData partnerData = new PlayerUnitData();
                partnerData.Init((byte)(i + 1),
                                 (byte)eTeamType.Team1,
                                 partner.GetLocName(),                //"Partner0",
                                 2 + (ulong)i,
                                 0,
                                 partner._partnerDataIndex,
                                 partner._NowLevel,
                                 partnerStats);

                partnerData.NormalAttackData[0] = new SkillData(partnerInfo.skill0, 1);
                partnerData.SkillData[0]        = new SkillData(partnerInfo.skill1, 1);
                partnerData.SkillData[1]        = new SkillData(partnerInfo.skill2, 1);
                partnerData.SkillData[2]        = new SkillData(partnerInfo.skill3, 1);
                partnerData.SkillData[3]        = new SkillData(partnerInfo.skill4, 1);

                //파트너 버프 삭제
                //if (partner.GetBuffSkillToSlot(0) != null)
                //	if (partner.GetBuffSkillToSlot(0)._skillIndex != 0)
                //		partnerData.PassiveBuff[0] = new SkillData(partner.GetBuffSkillToSlot(0)._skillIndex, (byte)partner.GetBuffSkillToSlot(0)._skillLevel);

                //if (partner.GetBuffSkillToSlot(1) != null)
                //	if (partner.GetBuffSkillToSlot(1)._skillIndex != 0)
                //		partnerData.PassiveBuff[1] = new SkillData(partner.GetBuffSkillToSlot(1)._skillIndex, (byte)partner.GetBuffSkillToSlot(1)._skillLevel);

                //if (partner.GetBuffSkillToSlot(2) != null)
                //	if (partner.GetBuffSkillToSlot(2)._skillIndex != 0)
                //		partnerData.PassiveBuff[2] = new SkillData(partner.GetBuffSkillToSlot(2)._skillIndex, (byte)partner.GetBuffSkillToSlot(2)._skillLevel);

                //if (partner.GetBuffSkillToSlot(3) != null)
                //	if (partner.GetBuffSkillToSlot(3)._skillIndex != 0)
                //		partnerData.PassiveBuff[3] = new SkillData(partner.GetBuffSkillToSlot(3)._skillIndex, (byte)partner.GetBuffSkillToSlot(3)._skillLevel);

                _playerSyncData.partnerSyncDatas.Add(partnerData);
            }
        }
    }
Exemplo n.º 16
0
    public void MakePlayerFreeFightSyncData(PMsgBattleMapEnterMapS netData)
    {
        //내 플레이어용 싱크데이터
        _playerSyncData = null;
        _playerSyncData = new _PlayerSyncData();

        PlayerUnitData myData = new PlayerUnitData();

        _playerSyncData.Init();

        Dictionary <AbilityType, float> playerStats = CalcPlayerStats();

        playerStats[AbilityType.HP]         = netData.UnHp;
        playerStats[AbilityType.SUPERARMOR] = netData.UnMaxSuperArmor;

        uint HELMETID = 0;
        uint CLOTHID  = 0;
        uint WEAPONID = 0;

        Item.EquipmentInfo tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.HELMET);
        if (tempInfo == null)
        {
            HELMETID = 0;
        }
        else
        {
            HELMETID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.CLOTH);
        if (tempInfo == null)
        {
            CLOTHID = 0;
        }
        else
        {
            CLOTHID = tempInfo.Id;
        }

        tempInfo = GetUserInfo().GetEquipPartsLowData(ePartType.WEAPON);
        if (tempInfo == null)
        {
            WEAPONID = 0;
        }
        else
        {
            WEAPONID = tempInfo.Id;
        }

        //ushort[] skillLevel = null;
        //uint equipCostumeId = 0;
        //if (GetUserInfo().GetEquipCostume() == null)
        //{
        //    Newbie.NewbieInfo newbieinfo = _LowDataMgr.instance.GetNewbieCharacterData(GetUserInfo()._userCharIndex);
        //    equipCostumeId = newbieinfo.CostumIdx;

        //    skillLevel = new ushort[] {
        //        1, 1, 1, 1, 1
        //    };
        //}
        //else
        //{
        //    equipCostumeId = GetUserInfo().GetEquipCostume()._costmeDataIndex;
        //    skillLevel = GetUserInfo().GetEquipCostume()._skillLevel;
        //}

        ushort[] skillLevel     = null;
        uint     equipCostumeId = 0;

        equipCostumeId = (uint)netData.UnCostumeId;
        skillLevel     = new ushort[] { 1, 1, 1, 1, 1 };

        //Item.CostumeInfo costumeData = _LowDataMgr.instance.GetLowDataCostumeInfo(equipCostumeId);
        SkillSetData skillSetData = GetUserInfo().GetEquipSKillSet();

        myData.Init(0,
                    0,
                    Nickname,
                    NetData.instance.AccountUUID,
                    0,
                    GetUserInfo().GetCharIdx(),
                    HELMETID,
                    equipCostumeId,
                    CLOTHID,
                    WEAPONID,
                    skillSetData.SkillSetId,
                    GetUserInfo().isHideCostum,
                    GetUserInfo()._Level,
                    GetUserInfo()._LeftTitle,
                    GetUserInfo()._RightTitle,
                    playerStats);

        uint skillIndex = 0;

        SkillTables.SkillSetInfo setInfo = _LowDataMgr.instance.GetLowDataSkillSet(skillSetData.SkillSetId);
        for (int i = 0; i < setInfo.skill0.Count; i++)
        {
            uint.TryParse(setInfo.skill0[i], out skillIndex);
            myData.NormalAttackData[i] = new SkillData(skillIndex, (byte)skillLevel[0]);
        }

        myData.SkillData[0] = new SkillData(skillSetData.SkillId[0], (byte)skillSetData.SkillLevel[0]);
        myData.SkillData[1] = new SkillData(skillSetData.SkillId[1], (byte)skillSetData.SkillLevel[1]);
        myData.SkillData[2] = new SkillData(skillSetData.SkillId[2], (byte)skillSetData.SkillLevel[2]);
        myData.SkillData[3] = new SkillData(skillSetData.SkillId[3], (byte)skillSetData.SkillLevel[3]);

        for (int i = 0; i < setInfo.Chain.Count; i++)
        {
            uint.TryParse(setInfo.Chain[i], out skillIndex);
            myData.SkillData[4 + i] = new SkillData(skillIndex, (byte)skillLevel[1]);
        }
        _playerSyncData.playerSyncDatas.Add(myData);
    }
Exemplo n.º 17
0
 public void SetPlayerUnitData(PlayerUnitData playerUnitData)
 {
     this.playerUnitData = playerUnitData;
 }
Exemplo n.º 18
0
    // ---------- Player Unit Creation ----------
    public PlayerUnitData CreatePlayerUnitData(PlayerUnitRank rank, UnitClass unitClass)
    {
        PlayerUnitData data = playerUnitData[rank][unitClass];

        return(data);
    }