Exemplo n.º 1
0
    // Start is called before the first frame update
    void Awake()
    {
        pd = new playerData();
        if (File.Exists(Application.streamingAssetsPath + "/PlayerData.json"))
        {
            jsonString = File.ReadAllText(Application.streamingAssetsPath + "/PlayerData.json");
        }
        else
        {
            jsonString = "";
            pd.players = new Dictionary <string, int>();
        }
        print(jsonString);

        if (jsonString != "")
        {
            pd.players = JsonConvert.DeserializeObject <Dictionary <string, int> >(jsonString);
            print(pd.players.Count);
        }

        score       = 00;
        timer       = 120f;
        gameStarted = false;
        foreach (GameObject a in scripts)
        {
            a.SetActive(false);
        }
    }
Exemplo n.º 2
0
 public playerData playerDataAdress()
 {
     path        = Path.Combine(Application.persistentDataPath, "playerData.json");
     jsonString  = File.ReadAllText(path);
     dataManager = JsonUtility.FromJson <playerData>(jsonString);
     return(dataManager);
 }
Exemplo n.º 3
0
    // Sets data.[variable] = [variable] from this script.
    void SetPlayerData(playerData data)
    {
        data.Username         = Username;
        data.ExperiencePoints = ExperiencePoints;
        data.blocksDestroyed  = blocksDestroyed;

        data.SelectedAbility = SelectedAbility;
        data.SelectedSkin    = SelectedSkin;
        data.MissionId       = MissionId;

        data.Leaderboard_Arcade      = Leaderboard_Arcade;
        data.Leaderboard_BossRush    = Leaderboard_BossRush;
        data.Leaderboard_Lucky       = Leaderboard_Lucky;
        data.Leaderboard_FullyLoaded = Leaderboard_FullyLoaded;
        data.Leaderboard_Scavenger   = Leaderboard_Scavenger;
        data.Leaderboard_Hell        = Leaderboard_Hell;
        data.Leaderboard_FastTrack   = DefaultLeaderboard_FastTrack;

        PlayerData.Leaderboard_Arcade      = Leaderboard_Arcade;
        PlayerData.Leaderboard_BossRush    = Leaderboard_BossRush;
        PlayerData.Leaderboard_Lucky       = Leaderboard_Lucky;
        PlayerData.Leaderboard_FullyLoaded = Leaderboard_FullyLoaded;
        PlayerData.Leaderboard_Scavenger   = Leaderboard_Scavenger;
        PlayerData.Leaderboard_Hell        = Leaderboard_Hell;
        PlayerData.Leaderboard_FastTrack   = Leaderboard_FastTrack;
    }
Exemplo n.º 4
0
    public void Save()
    {
        BinaryFormatter bf = new BinaryFormatter();

        if (File.Exists(Application.persistentDataPath + "/PlayerInfo.dat"))
        {
            Debug.Log("YES");
            FileStream file = File.Open(Application.persistentDataPath + "/PlayerInfo.dat", FileMode.Open);
            Debug.Log("Opened");
            playerData data = new playerData();
            Debug.Log("Created new playerData");
            data.Score = Score;
            Debug.Log("Before Serialize");
            bf.Serialize(file, Score);

            Debug.Log("After Serialize");
            file.Close();
            Debug.Log("Closed");
        }
        else
        {
            Debug.Log("NO");
            FileStream file = File.Create(Application.persistentDataPath + "/PlayerInfo.dat");

            playerData data = new playerData();
            data.Score = Score;

            bf.Serialize(file, Score);
            file.Close();
        }
    }
Exemplo n.º 5
0
    public int loadLastPlane()
    {
        dataManager = playerDataAdress();
        planeNumberData.planeNumber = dataManager.planeNumber;

        return(dataManager.planeNumber);
    }
Exemplo n.º 6
0
    public void purchase(int itemNum, int itemPrice)
    {
        dataManager = playerDataAdress();

        if (dataManager.gold >= itemPrice)
        {
            purchaseState = true;
            // saving gold amount
            dataManager.gold -= itemPrice;
            string writeJson = JsonUtility.ToJson(dataManager);
            File.WriteAllText(path, writeJson);


            // reading purchase data


            purchaseManager = purchaseDataAdress();

            if (itemNum == 1)
            {
                purchaseManager.firstPlane = 1;
                writeJson = JsonUtility.ToJson(purchaseManager);
                File.WriteAllText(pPath, writeJson);
            }
        }
        else
        {
            notEnoughGold = true;
        }
    }
Exemplo n.º 7
0
    public void LoadPlayer()
    {
        playerData data = SaveSystem.LoadPlayer();

        totalCoins = data.coins;
        coinShow.SetText("Coins:{0}", totalCoins);
    }
Exemplo n.º 8
0
Arquivo: hit.cs Projeto: aekly268/Sumo
 // Use this for initialization
 void Start()
 {
     body           = GetComponent <Rigidbody2D>();
     data           = GetComponent <playerData>();
     autoShootTimer = 0;
     music          = GetComponent <PlayerMusic>();
 }
Exemplo n.º 9
0
    public static playerData LoadPlayer()
    {
        string path = Application.persistentDataPath + "/level.yeur";

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);
            try
            {
                playerData data = formatter.Deserialize(stream) as playerData;
                stream.Close();
                Debug.Log(data.maxlevel);
                return(data);
            } finally
            {
                stream.Close();
            }
        }
        else
        {
            Debug.LogError("Save file not found in " + path);
            return(null);
        }
    }
Exemplo n.º 10
0
    public void Load()
    {
        if (File.Exists(Application.persistentDataPath + "/playerData.nut"))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/playerData.nut", FileMode.Open);
            playerData      data = (playerData)bf.Deserialize(file);

            //<<<-------------LOADING DATA--------------->>>
            Food          = data.food; Water = data.water; Honey = data.honey;
            storyProgress = data.storyProgress;
            for (int i = 0; i <= storyProgress; i++)
            {
                if (i == 0)
                {
                    highlightStory(i);
                }
                else
                {
                    highlightStory(i, i - 1);
                }
            }

            ChangeResourceText.UpdateUIResources(Food, Water, Honey);

            Hex a = Map.map.GetHexAt(data.q, data.r);           //store q and r of hex so it can be retreived
            SetHex(a);
            //<<<-------------END OF LOADING DATA--------------->>>

            file.Close();
        }
    }
Exemplo n.º 11
0
    public void Save()
    {
        //Assign all the values for saving
        _s_SFX = AudioManager.SFXVolume;
        _s_BGM = AudioManager.BGMVolume;

        BinaryFormatter bf_writer = new BinaryFormatter();
        FileStream      _file     = File.Create(Application.persistentDataPath + _filePath);

        //taking data from control to put into saving class.
        playerData data = new playerData();

        {
            data.monsterCount   = _monsterCount;
            data.level          = _level;
            data.sound_BGM      = _s_BGM;
            data.sound_SFX      = _s_SFX;
            data.coins          = _coins;
            data.bossTotalTime  = _bossTotalTime;
            data.coinMultiplier = _coinMultiplier;
            data.ally1Level     = _ally1Level;
            data.ally1Cost      = _ally1Cost;
        }

        //writing it to that file path
        bf_writer.Serialize(_file, data);

        _file.Close();
    }
Exemplo n.º 12
0
    [ContextMenu("From Json Data")]//json에서 데이터로 불러오ㅇ
    void LoadPlayerDataFromJson()
    {
        string path     = Path.Combine(Application.dataPath, "playerData.json"); //현재 유니티 프로젝트 경로에 저장
        string jsonData = File.ReadAllText(path);                                //경로로 부터 데이터 가져옴

        playerData = JsonUtility.FromJson <playerData>(jsonData);
    }
Exemplo n.º 13
0
    public void Save()
    {
        BinaryFormatter bf = new BinaryFormatter();
        if(File.Exists (Application.persistentDataPath + "/PlayerInfo.dat"))
        {
            Debug.Log("YES");
            FileStream file = File.Open(Application.persistentDataPath + "/PlayerInfo.dat",FileMode.Open);
            Debug.Log("Opened");
            playerData data = new playerData();
            Debug.Log("Created new playerData");
            data.Score = Score;
            Debug.Log("Before Serialize");
            bf.Serialize(file,Score);

            Debug.Log("After Serialize");
            file.Close ();
            Debug.Log("Closed");
        }
        else
        {
            Debug.Log("NO");
            FileStream file = File.Create(Application.persistentDataPath + "/PlayerInfo.dat");

            playerData data = new playerData();
            data.Score = Score;

            bf.Serialize(file,Score);
            file.Close ();
        }
    }
Exemplo n.º 14
0
    // Sets variables in this script by getting data from save file.
    void LoadPlayerDataContents(playerData data)
    {
        Username         = data.Username;
        ExperiencePoints = data.ExperiencePoints;
        blocksDestroyed  = data.blocksDestroyed;

        SelectedAbility = data.SelectedAbility;
        SelectedSkin    = data.SelectedSkin;
        MissionId       = data.MissionId;

        Leaderboard_Arcade      = data.Leaderboard_Arcade;
        Leaderboard_BossRush    = data.Leaderboard_BossRush;
        Leaderboard_Lucky       = data.Leaderboard_Lucky;
        Leaderboard_FullyLoaded = data.Leaderboard_FullyLoaded;
        Leaderboard_Scavenger   = data.Leaderboard_Scavenger;
        Leaderboard_Hell        = data.Leaderboard_Hell;
        Leaderboard_FastTrack   = data.Leaderboard_FastTrack;

        PlayerData.Leaderboard_Arcade      = Leaderboard_Arcade;
        PlayerData.Leaderboard_BossRush    = Leaderboard_BossRush;
        PlayerData.Leaderboard_Lucky       = Leaderboard_Lucky;
        PlayerData.Leaderboard_FullyLoaded = Leaderboard_FullyLoaded;
        PlayerData.Leaderboard_Scavenger   = Leaderboard_Scavenger;
        PlayerData.Leaderboard_Hell        = Leaderboard_Hell;
        PlayerData.Leaderboard_FastTrack   = Leaderboard_FastTrack;
    }
    playerData Load()
    {
        playerData pData    = new playerData();
        string     dataJson = File.ReadAllText(dataPath);

        JsonUtility.FromJsonOverwrite(dataJson, pData);
        return(pData);
    }
Exemplo n.º 16
0
    playerData Load()
    {
        playerData pData    = new playerData();
        string     dataJson = File.ReadAllText(Path.Combine(Application.streamingAssetsPath, "data.txt"));

        JsonUtility.FromJsonOverwrite(dataJson, pData);
        return(pData);
    }
Exemplo n.º 17
0
    // Load PlayerData main.
    public void LoadPlayerData()
    {
                #if !UNITY_EDITOR
        if (AllowLoading == true)
        {
            if (File.Exists(Application.persistentDataPath + "/" + Username + "_PlayerConfig.dat") == true)
            {
                // Opens the save data.
                BinaryFormatter bf   = new BinaryFormatter();
                FileStream      file = File.Open(Application.persistentDataPath + "/" + Username + "_PlayerConfig.dat", FileMode.Open);

                // Processes the save data into memory.
                playerData data = (playerData)bf.Deserialize(file);
                file.Close();

                LoadPlayerDataContents(data);
                StorePlayerDataInGame();

                Debug.Log("Successfully loaded from " +
                          Application.persistentDataPath + "/" + Username + "_PlayerConfig.dat");
            }

            else

            {
                SavePlayerData();
            }
        }
                #endif

                #if UNITY_EDITOR
        if (AllowLoading == true)
        {
            if (File.Exists(Application.persistentDataPath + "/" + Username + "_PlayerConfig_Editor.dat") == true)
            {
                // Opens the save data.
                BinaryFormatter bf   = new BinaryFormatter();
                FileStream      file = File.Open(Application.persistentDataPath + "/" + Username + "_PlayerConfig_Editor.dat", FileMode.Open);

                // Processes the save data into memory.
                playerData data = (playerData)bf.Deserialize(file);
                file.Close();

                LoadPlayerDataContents(data);
                StorePlayerDataInGame();

                Debug.Log("Successfully loaded from " +
                          Application.persistentDataPath + "/" + Username + "_PlayerConfig_Editor.dat");
            }

            else

            {
                SavePlayerData();
            }
        }
                #endif
    }
Exemplo n.º 18
0
    public static playerData restauraDados(string S)
    {
        byte[]          bytes     = Convert.FromBase64String(S);
        MemoryStream    str       = new MemoryStream(bytes);
        BinaryFormatter bf        = new BinaryFormatter();
        playerData      dadosTemp = bf.Deserialize(str) as playerData;

        return(dadosTemp);
    }
Exemplo n.º 19
0
    public static void SavePlayer(GM gm)
    {
        BinaryFormatter bf     = new BinaryFormatter();
        FileStream      streem = new FileStream(Application.persistentDataPath + "/Lol.abh", FileMode.Create);
        playerData      data   = new playerData(gm);

        bf.Serialize(streem, data);
        streem.Close();
    }
Exemplo n.º 20
0
    public PlayerGetData(playerData player)
    {
        level = player.level;

        position    = new float[3];
        position[0] = player.transform.position.x;
        position[1] = player.transform.position.y;
        position[2] = player.transform.position.z;
    }
Exemplo n.º 21
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        playerData col_data = col.gameObject.GetComponent <playerData>();

        col_data.SetScore(5);

        this.gameObject.SetActive(false);
        GameManager.game.GetComponent <FoodSystem>().food_Unused.Enqueue(this.gameObject);
    }
Exemplo n.º 22
0
    void Awake()
    {
        Debug.Log("Save Test: " + StaticSaveFile.save);
        if (StaticSaveFile.save == "save")
        {
            playerData data = SaveSystem.LoadPlayer();
            stage = data.stage;
        }
        else
        {
            stage = 4;
        }

        initialHealth_p = ((stage - 1) * 100f) + 400f;
        totalExp        = ((stage - 1) * 50) + 500;
        currentExp      = 0;

        initialHealth_e = ((stage - 1) * 50f) + 73f;
        expGained_e     = 50;

        initialHealth_b = 100f;
        expGained_b     = 50;

        totalStamina_p = ((stage - 1) * 2f) + 93f;
        attackDamage_p = ((stage - 1) * 20f) + 73f;
        stamina_p      = ((stage - 1) * 4f) + 19f;
        regenRate_p    = ((stage - 1) * 20f) + 40f;

        totalStamina_e = ((stage - 1) * 10f) + 400f;
        attackDamage_e = ((stage - 1) * 10f) + 30f;
        stamina_e      = ((stage - 1) * 10f) + 60f;
        regenRate_e    = ((stage - 1) * 15f) + 30f;

        totalStamina_b = ((stage - 1) * 500f) + 1000f;
        attackDamage_b = ((stage - 1) * 40f) + 80f;
        stamina_b      = ((stage - 1) * 50f) + 120f;
        regenRate_b    = ((stage - 1) * 20f) + 40f;

        currency_p       = 0;
        current_currency = 0;
        saved_currency   = 0;
        currency_e       = ((stage - 1) * 10) + 10;
        currency_b       = ((stage - 1) * 100) + 100;

        currentPotions = ((stage - 1) * 2) + 5;
        regenHealth    = ((stage - 1) + 70) + 250f;

        currentHealth_p = initialHealth_p;
        currentHealth_e = initialHealth_e;
        currentHealth_b = initialHealth_b;

        currentStamina_p = totalStamina_p;
        currentStamina_e = totalStamina_e;
        currentStamina_b = totalStamina_b;
        liveCounter      = 3;
    }
Exemplo n.º 23
0
    public bool Validate(mission m)
    {
        bool missionComplete = true;

        // a mission with zero tokens is always false
        if (m.tokens.Count <= 0)
        {
            missionComplete = false;
        }

        // for all tokens in the mission
        for (int i = 0; i < m.tokens.Count; i++)
        {
            // search for each one in the cache
            // if it is not in the cache, then abort->this mission is not complete yet
            bool tokenFound = false;
            for (int j = 0; j < missionTokens.Count; j++)
            {
                if (missionTokens[j] != null && (m.tokens[i].id == missionTokens[j].id))
                {
                    tokenFound = true;
                    break;
                }
            }

            // searched the entire token cache and didn't find the mission token, so mission must be incomplete
            // lets abort now
            if (tokenFound == false)
            {
                missionComplete = false;
                break;
            }
        }

        // award points one time if mission is finished.  We won't do this again because the mission's state will change
        // to MS_COMPLETE and we will no longer evaluate it.
        if (missionComplete == true)
        {
            // get the playerData and add score the player's score
            GameObject go = GameObject.Find("Player");
            if (go == null)
            {
                go = GameObject.Find("Player1");
            }
            if (go)
            {
                playerData pd = go.GetComponent <playerData>();
                if (pd)
                {
                    pd.AddScore(m.points);
                }
            }
        }

        return(missionComplete);
    }
    private void Awake()
    {
        dataPath = Path.Combine(Application.streamingAssetsPath, "data.txt");



        playerdata     = Load();
        highScore.text = "Highscore : " + playerdata.highScore.ToString();
        updateSettings();
    }
Exemplo n.º 25
0
    public static void guardarJugador(player Jugador)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          direccion = Application.persistentDataPath + "/jugador.krg";
        FileStream      stream    = new FileStream(direccion, FileMode.Create);
        playerData      data      = new playerData(Jugador);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Exemplo n.º 26
0
    public static void SavePlayer(Stats stats)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/player.savedata";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        playerData data = new playerData(stats);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Exemplo n.º 27
0
    public static void SavePlayer(playerController pC, upgradeMaster crM, upgradeMaster caM, upgradeMaster fM, sneakerInventory sI, upgradeMaster aCM)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/player.fun";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        playerData data = new playerData(pC, crM, caM, fM, sI, aCM);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Exemplo n.º 28
0
    public static void saveCharacterInfo(Player player)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/char.nfo";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        playerData data = new playerData(player);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Exemplo n.º 29
0
    public static void savePlayer(playerData player)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/player.sv";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        PlayerGetData data = new PlayerGetData(player);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Exemplo n.º 30
0
    public static void SavePlayer(playerController player)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Path.Combine(Application.persistentDataPath, "playerData.bi");
        FileStream      stream    = new FileStream(path, FileMode.Create);

        playerData data = new playerData(player);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Exemplo n.º 31
0
    public void PostShoot(bool isPlayer)
    {
        playerData player1 = new playerData();
        playerData player2 = new playerData();

        switch (pos.current)
        {
        case 0:
            player1 = center;
            player2 = centerCPU;
            break;

        case 1:
            player1 = right;
            player2 = rightCPU;
            break;

        case 2:
            player1 = left;
            player2 = leftCPU;
            break;

        case 3:
            player1 = post;
            player2 = postCPU;
            break;
        }
        if (!isPlayer)
        {
            playerData temp = player1;
            player1 = player2;
            player2 = temp;
        }
        System.Random rng     = new System.Random();
        int           contest = rng.Next(4);
        int           chance;

        if (player1.postShooting >= player1.postHandle)
        {
            chance = player1.postShooting * 3 / 4;
        }
        else
        {
            chance = player1.postHandle * 3 / 4;
        }
        if (contest == 0)
        {
            chance -= player2.postD / 2;
        }
        if (rng.Next(100) < chance)
        {
            score.shoot2(isPlayer);
        }
    }
Exemplo n.º 32
0
        private void incomingPlayerData(playerData player)
        {
            if (player.Action == "Remove")
                GameWorld.GetInstance.listEntity.Find(p => p.EntityName == player.Name).KeepAliveTime = 0; // removed in next update
            else if (player.Action == "Online")
            { }
            else if (player.Action == "Sprite_Update" && player.Name == PlayerStore.Instance.activePlayer.Name)
            {
                PlayerSprite sprite = GameWorld.GetInstance.playerSprite;

                if (sprite.State.ToString() != player.spritestate ||
                    sprite.State == EntityState.Ladder ||
                    sprite.State == EntityState.Rope)
                {
                    sprite.State = (EntityState)Enum.Parse(typeof(EntityState), player.spritestate);
                    sprite.Position = new Vector2(player.PositionX, player.PositionY);
                    //sprite.PLAYER_SPEED = 190;
                }
                else if (Math.Abs(sprite.Position.X - player.PositionX) >= 1 &&
                         Math.Abs(sprite.Position.X - player.PositionX) <= 80) // avoid lag
                {
                    if (sprite.spriteEffect == SpriteEffects.None)
                        sprite.PLAYER_SPEED += (int)(sprite.Position.X - player.PositionX) * 2;
                    else
                        sprite.PLAYER_SPEED -= (int)(sprite.Position.X - player.PositionX) * 2;

                    sprite.PLAYER_SPEED = Clamp(sprite.PLAYER_SPEED, 165, 265);
                }
                else if (Math.Abs(sprite.Position.X - player.PositionX) > 80)
                    sprite.Position = new Vector2(player.PositionX, player.PositionY);
            }
            else if (player.Name != PlayerStore.Instance.activePlayer.Name) // Networkplayer
            {
                if (GameWorld.GetInstance.listEntity.FindAll(x => x.EntityName == player.Name).Count > 0)
                {
                    NetworkPlayerSprite sprite = (NetworkPlayerSprite)GameWorld.GetInstance.listEntity.Find(x => x.EntityName == player.Name);
                    sprite.MapName = player.mapName;

                    if (sprite.State.ToString() != player.spritestate ||
                        sprite.spriteEffect.ToString() != player.spriteEffect ||
                        ((sprite.State == EntityState.Ladder || sprite.State == EntityState.Rope) &&
                        sprite.Direction != NetworkPlayerSprite.getVector(player.direction)))
                    {

                        sprite.previousPosition = sprite.Position;   // save previous postion
                        sprite.PreviousState = sprite.State;         // save previous state before
                        sprite.previousDirection = sprite.Direction; // save previous direction

                        sprite.State = (EntityState)Enum.Parse(typeof(EntityState), player.spritestate);
                        sprite.Position = new Vector2(player.PositionX, player.PositionY);
                        sprite.spriteEffect = (SpriteEffects)Enum.Parse(typeof(SpriteEffects), player.spriteEffect);
                        sprite.Direction = NetworkPlayerSprite.getVector(player.direction);
                        //sprite.PLAYER_SPEED = 190;
                    }
                    else if (Math.Abs(sprite.Position.X - player.PositionX) >= 1 &&
                            Math.Abs(sprite.Position.X - player.PositionX) <= 80) // avoid lag
                    {
                        if (sprite.spriteEffect == SpriteEffects.None)
                            sprite.PLAYER_SPEED += (int)(sprite.Position.X - player.PositionX) * 2;
                        else
                            sprite.PLAYER_SPEED -= (int)(sprite.Position.X - player.PositionX) * 2;

                        sprite.PLAYER_SPEED = Clamp(sprite.PLAYER_SPEED, 165, 265);
                    }
                    else if (Math.Abs(sprite.Position.X - player.PositionX) > 80)
                        sprite.Position = new Vector2(player.PositionX, player.PositionY);
                }
                else
                {
                    if (GameWorld.GetInstance.newEntity.FindAll(x => x.EntityName == player.Name).Count == 0)
                        GameWorld.GetInstance.newEntity.Add(
                            new NetworkPlayerSprite(
                                player.Name, player.IP,
                                player.PositionX, player.PositionY,
                                player.spritename, player.spritestate,
                                player.prevspriteframe, player.maxspriteframe,
                                player.attackSprite, player.spriteEffect,
                                player.mapName, player.skincol,
                                player.facespr, player.hairspr,
                                player.hailcol, player.armor,
                                player.headgear, player.weapon));
                }
            }
        }
Exemplo n.º 33
0
        private void incomingCharSelect(playerData playerdata)
        {
            bool found = false;
            for(int i = 0; i < PlayerStore.Instance.playerlist.Length; i++)
            {
                if (PlayerStore.Instance.playerlist[i] != null)
                {
                    if (PlayerStore.Instance.playerlist[i].Name == playerdata.Name) // avoid duplicates
                    {
                        found = true;
                        break;
                    }
                }
            }

            if (!found)
            {
                PlayerInfo player = new PlayerInfo();

                player.AccountID = playerdata.AccountID;
                player.CharacterID = playerdata.CharacterID;

                player.Name = playerdata.Name;
                player.skin_color = getColor(playerdata.skincol);
                player.faceset_sprite = playerdata.facespr;
                player.hair_sprite = playerdata.hairspr;
                player.hair_color = getColor(playerdata.hailcol);

                if (playerdata.armor != null)
                    if (ItemStore.Instance.item_list.FindAll(x => x.itemName == playerdata.armor).Count > 0)
                        player.equipment.addItem(ItemStore.Instance.item_list.Find(x => x.itemName == playerdata.armor));
                if (playerdata.weapon != null)
                    if (ItemStore.Instance.item_list.FindAll(x => x.itemName == playerdata.weapon).Count > 0)
                        player.equipment.addItem(ItemStore.Instance.item_list.Find(x => x.itemName == playerdata.weapon));
                if (playerdata.headgear != null)
                    if (ItemStore.Instance.item_list.FindAll(x => x.itemName == playerdata.headgear).Count > 0)
                        player.equipment.addItem(ItemStore.Instance.item_list.Find(x => x.itemName == playerdata.headgear));

                PlayerStore.Instance.addPlayer(player);
            }
        }
Exemplo n.º 34
0
 /*
 public baseAmmo 	Ammo Type;
 public float 		Time Between Shots;
 public float 		Shot Damage;
 public float 		Shot Variation;
 public int 			Number Of Shots To Shoot;
 public float 		Accuracy;
                     Zoomed Field Of View;
                     Ammo To Restore On Pickup;
                     Shot Speed;
     */
 //public
 // Use this for initialization
 void Start()
 {
     pD = player.GetComponent<playerData>();
     defaultTime = timeBetweenShots;
     cam = Camera.main;
     defaultFOV = cam.fieldOfView;
     defaultLocation = weaponAnchor.transform.localPosition;
     animator = gameObject.GetComponent<Animator>();
     //inv = gameObject.GetComponent<playerInventory>();
     if(ammoType == baseAmmo.LaserBolt){
         usedProj = projectiles[0];
         //shotSpeed = 20;
         shotVariation = 0.1f;
     }
     else if(ammoType == baseAmmo.Laser){
         usedProj = projectiles[1];
         //shotSpeed = 25;
         shotVariation = 0f;
     }
     else if(ammoType == baseAmmo.Bullet){
         usedProj = projectiles[2];
         //shotSpeed = 40;
         shotVariation = 0.12f;
     }
     else if(ammoType == baseAmmo.Pellet){
         usedProj = projectiles[3];
         //shotSpeed = 10;
         shotVariation = 0.2f;
     }
     else if(ammoType == baseAmmo.Missile){
         usedProj = projectiles[4];
         //shotSpeed = 20;
         shotVariation = 0.2f;
     }
     else if(ammoType == baseAmmo.GrenadePill){
         usedProj = projectiles[5];
         //shotSpeed = 10;
         shotVariation = 0.2f;
     }
     else if(ammoType == baseAmmo.Energy){
         usedProj = projectiles[6];
         //shotSpeed = 20;
         shotVariation = 0.2f;
     }
     Cursor.lockState = CursorLockMode.Locked;
 }