public void RightBtnPress()
    {
        hubWorldSFX.PlayHubSoundEffect(HubWorldSFX.HubSoundeffect.ButtonPress);
        switch (hackerOrRunner)
        {
        case Item.HackerRunner.Runner:
            if (currentIndex + 1 >= runners.Count)
            {
                currentIndex = 0;
            }
            else
            {
                currentIndex++;
            }
            shownRunner = runners[currentIndex];
            break;

        case Item.HackerRunner.Hacker:
            if (currentIndex + 1 >= hackers.Count)
            {
                currentIndex = 0;
            }
            else
            {
                currentIndex++;
            }
            shownHacker = hackers[currentIndex];
            break;
        }
        UpdateDisplayedCharacter();
    }
Пример #2
0
    public static HackerData SetTestHackerOne()
    {
        HackerData newHacker = ScriptableObject.CreateInstance <HackerData>();

        newHacker.CreateNewHackerByClassId(0);

        return(newHacker);
    }
    public void LoadMapTestOne()
    {
        currentRunner = playerData.GetCurrentRunner();
        currentHacker = playerData.GetCurrentHacker();
        Job job = ScriptableObject.CreateInstance <Job>();

        job.GenerateJob(0);
        LoadMap(Job.JobArea.Slums, 20, job);
    }
Пример #4
0
 public void SetMapData(CharacterData characterToSet, HackerData hackerToSet, Job.JobArea newMapType, int newSecurityLevel, int newMapSize, Job newJob)
 {
     runner        = characterToSet;
     hacker        = hackerToSet;
     mapType       = newMapType;
     securityLevel = newSecurityLevel;
     mapSize       = newMapSize;
     job           = newJob;
 }
    private void RefreshPlayerData()
    {
        PlayerData playerData = FindObjectOfType <PlayerData>();

        currentRunner = playerData.GetCurrentRunner();
        currentHacker = playerData.GetCurrentHacker();

        runnerPortraitImage.sprite = currentRunner.GetRunnerPortraitFull();
        runnerName.text            = currentRunner.GetRunnerName();

        hackerPortraitImage.sprite = currentHacker.GetHackerPortraitFull();
        hackerName.text            = currentHacker.GetName();
    }
    public void LoadMap(Job.JobArea mapType, int mapSize, Job job)
    {
        PlayerData playerData = FindObjectOfType <PlayerData>();

        currentRunner = playerData.GetCurrentRunner();

        currentRunner.ResetHealthAndEnergy();

        currentHacker = playerData.GetCurrentHacker();
        currentMap    = Instantiate(mapData);
        currentMap.SetMapData(currentRunner, currentHacker, mapType, 10, mapSize, job);
        ChangeMusicTrack(job.GetJobArea());

        //SceneManager.LoadScene(mapSceneName);
        transitioner.gameObject.SetActive(true);
        Transitioner.Instance.TransitionToScene(mapSceneName);

        StartCoroutine(WaitForMapLoad(mapSceneName));
    }
    public void SetupCharacterSelectMenu(Item.HackerRunner newHackerOrRunner)
    {
        hackerOrRunner = newHackerOrRunner;
        PlayerData playerData = FindObjectOfType <PlayerData>();

        switch (hackerOrRunner)
        {
        case Item.HackerRunner.Runner:
            headingTextImage.sprite = selectRunnerSprite;
            currentRunner           = playerData.GetCurrentRunner();
            shownRunner             = currentRunner;
            runners = playerData.GetRunnerList();
            for (int i = 0; i < runners.Count; i++)
            {
                if (runners[i] == currentRunner)
                {
                    currentIndex = i;
                    break;
                }
            }
            break;

        case Item.HackerRunner.Hacker:
            headingTextImage.sprite = selectHackerSprite;
            currentHacker           = playerData.GetCurrentHacker();
            shownHacker             = currentHacker;
            hackers = playerData.GetHackerList();
            for (int i = 0; i < hackers.Count; i++)
            {
                if (hackers[i] == currentHacker)
                {
                    currentIndex = i;
                    break;
                }
            }
            break;
        }
        UpdateDisplayedCharacter();
    }
 public void SetupLoadoutEquipmentMenu(HackerData newHacker)
 {
     hacker         = newHacker;
     hackerOrRunner = Item.HackerRunner.Hacker;
     DoSetup();
 }
Пример #9
0
    public void LoadPlayer(int saveSlotToLoad)
    {
        SaveObject saveObject = SaveSystem.LoadPlayerData(saveSlotToLoad);

        // Recreate Owned Items
        ownedItems = new List <Item>();
        List <SaveItem> deserializedSaveItems = JsonConvert.DeserializeObject <List <SaveItem> >(saveObject.items);

        foreach (SaveItem saveItem in deserializedSaveItems)
        {
            if (saveItem.hackerOrRunner == (int)Item.HackerRunner.Hacker)
            {
                // Hacker Items
                if (saveItem.itemType == (int)Item.ItemTypes.Rig || saveItem.itemType == (int)Item.ItemTypes.NeuralImplant || saveItem.itemType == (int)Item.ItemTypes.Uplink)
                {
                    HackerMod newHackerMod = ScriptableObject.CreateInstance <HackerMod>();
                    newHackerMod.RecreateSavedHackerMod(saveItem);
                    ownedItems.Add(newHackerMod);
                }
                else
                {
                    HackerModChip newHackerModChip = ScriptableObject.CreateInstance <HackerModChip>();
                    newHackerModChip.RecreateSavedHackerModChip(saveItem);
                    ownedItems.Add(newHackerModChip);
                }
            }
            else if (saveItem.hackerOrRunner == (int)Item.HackerRunner.Runner)
            {
                // Create Runner Items
                RunnerMod newRunnerMod = ScriptableObject.CreateInstance <RunnerMod>();
                newRunnerMod.RecreateSavedRunnerMod(saveItem);
                ownedItems.Add(newRunnerMod);
            }
        }

        // Create Runners
        List <SaveRunner> saveRunners = JsonConvert.DeserializeObject <List <SaveRunner> >(saveObject.runners);

        ownedRunners = new List <CharacterData>();
        foreach (SaveRunner saveRunner in saveRunners)
        {
            CharacterData newRunner = ScriptableObject.CreateInstance <CharacterData>();
            newRunner.RecreateRunnerFromSaveData(saveRunner);

            Loadout runnerLoadout = newRunner.GetLoadout();
            runnerLoadout.EquipItem((RunnerMod)GetLoadedItemById(saveRunner.headItemId));
            runnerLoadout.EquipItem((RunnerMod)GetLoadedItemById(saveRunner.torsoModId));
            runnerLoadout.EquipItem((RunnerMod)GetLoadedItemById(saveRunner.exoskeletonModId));
            runnerLoadout.EquipItem((RunnerMod)GetLoadedItemById(saveRunner.leftArmModId), Loadout.LeftOrRight.Left);
            runnerLoadout.EquipItem((RunnerMod)GetLoadedItemById(saveRunner.rightArmModId), Loadout.LeftOrRight.Right);
            runnerLoadout.EquipItem((RunnerMod)GetLoadedItemById(saveRunner.leftLegModId), Loadout.LeftOrRight.Left);
            runnerLoadout.EquipItem((RunnerMod)GetLoadedItemById(saveRunner.rightLegModId), Loadout.LeftOrRight.Right);
            runnerLoadout.EquipItem((RunnerMod)GetLoadedItemById(saveRunner.weaponModId));

            ownedRunners.Add(newRunner);
            if (newRunner.GetRunnerId() == saveObject.currentRunner)
            {
                currentRunner = newRunner;
            }
        }

        List <SaveHacker> saveHackers = JsonConvert.DeserializeObject <List <SaveHacker> >(saveObject.hackers);

        ownedHackers = new List <HackerData>();
        foreach (SaveHacker saveHacker in saveHackers)
        {
            HackerData newHacker = ScriptableObject.CreateInstance <HackerData>();
            newHacker.RecreateHackerFromSave(saveHacker);

            if (!newHacker.GetIsLocked())
            {
                HackerMod newRigMod = (HackerMod)GetLoadedItemById(saveHacker.rigModId);
                if (saveHacker.rigSoftwareId1 != -1)
                {
                    newRigMod.InstallChip((HackerModChip)GetLoadedItemById(saveHacker.rigSoftwareId1), 0);
                }
                if (saveHacker.rigSoftwareId2 != -1)
                {
                    newRigMod.InstallChip((HackerModChip)GetLoadedItemById(saveHacker.rigSoftwareId2), 1);
                }
                if (saveHacker.rigSoftwareId3 != -1)
                {
                    newRigMod.InstallChip((HackerModChip)GetLoadedItemById(saveHacker.rigSoftwareId3), 2);
                }
                newHacker.GetHackerLoadout().EquipRecreatedItem(newRigMod);

                HackerMod newNeuralImplantMod = (HackerMod)GetLoadedItemById(saveHacker.neuralImplantId);
                if (saveHacker.neuralWetwareId1 != -1)
                {
                    newNeuralImplantMod.InstallChip((HackerModChip)GetLoadedItemById(saveHacker.neuralWetwareId1), 0);
                }
                if (saveHacker.neuralWetwareId2 != -1)
                {
                    newNeuralImplantMod.InstallChip((HackerModChip)GetLoadedItemById(saveHacker.neuralWetwareId2), 1);
                }
                if (saveHacker.neuralWetwareId3 != -1)
                {
                    newNeuralImplantMod.InstallChip((HackerModChip)GetLoadedItemById(saveHacker.neuralWetwareId3), 2);
                }
                newHacker.GetHackerLoadout().EquipRecreatedItem(newNeuralImplantMod);

                HackerMod newUplinkMod = (HackerMod)GetLoadedItemById(saveHacker.uplinkId);
                if (saveHacker.uplinkChipsetId1 != -1)
                {
                    newUplinkMod.InstallChip((HackerModChip)GetLoadedItemById(saveHacker.uplinkChipsetId1), 0);
                }
                if (saveHacker.uplinkChipsetId2 != -1)
                {
                    newUplinkMod.InstallChip((HackerModChip)GetLoadedItemById(saveHacker.uplinkChipsetId2), 1);
                }
                if (saveHacker.uplinkChipsetId3 != -1)
                {
                    newUplinkMod.InstallChip((HackerModChip)GetLoadedItemById(saveHacker.uplinkChipsetId3), 2);
                }
                newHacker.GetHackerLoadout().EquipRecreatedItem(newUplinkMod);
            }

            ownedHackers.Add(newHacker);
            if (newHacker.GetHackerId() == saveObject.currentHacker)
            {
                currentHacker = newHacker;
            }
        }

        List <SaveJob> saveJobs = JsonConvert.DeserializeObject <List <SaveJob> >(saveObject.jobOptions);

        currentJobOptions = new List <Job>();
        foreach (SaveJob saveJob in saveJobs)
        {
            Job newJob = ScriptableObject.CreateInstance <Job>();
            newJob.LoadJobFromSave(saveJob);

            currentJobOptions.Add(newJob);
        }

        // General Player Data
        currentCredits  = saveObject.playerCredits;
        generatedItemId = saveObject.currentItemId;
        saveSlot        = saveObject.saveSlot;

        // Shop Stuff
        currentShopType   = (ShopMenu.ShopForSaleType)saveObject.currentShopType;
        previousShopTypes = new List <ShopMenu.ShopForSaleType>();
        List <int> shopTypeIds = JsonConvert.DeserializeObject <List <int> >(saveObject.previousShopTypes);

        foreach (int shopTypeId in shopTypeIds)
        {
            previousShopTypes.Add((ShopMenu.ShopForSaleType)shopTypeId);
        }

        List <SaveItem> savedShopItems = JsonConvert.DeserializeObject <List <SaveItem> >(saveObject.itemsForSale);

        itemsForSale = new List <Item>();
        foreach (SaveItem saveItem in savedShopItems)
        {
            if (saveItem.hackerOrRunner == (int)Item.HackerRunner.Hacker)
            {
                // Hacker Items
                if (saveItem.itemType == (int)Item.ItemTypes.Rig || saveItem.itemType == (int)Item.ItemTypes.NeuralImplant || saveItem.itemType == (int)Item.ItemTypes.Uplink)
                {
                    HackerMod newHackerMod = ScriptableObject.CreateInstance <HackerMod>();
                    newHackerMod.RecreateSavedHackerMod(saveItem);
                    itemsForSale.Add(newHackerMod);
                }
                else
                {
                    HackerModChip newHackerModChip = ScriptableObject.CreateInstance <HackerModChip>();
                    newHackerModChip.RecreateSavedHackerModChip(saveItem);
                    itemsForSale.Add(newHackerModChip);
                }
            }
            else if (saveItem.hackerOrRunner == (int)Item.HackerRunner.Runner)
            {
                // Create Runner Items
                RunnerMod newRunnerMod = ScriptableObject.CreateInstance <RunnerMod>();
                newRunnerMod.RecreateSavedRunnerMod(saveItem);
                itemsForSale.Add(newRunnerMod);
            }
        }

        isPlayerLoaded = true;
    }
Пример #10
0
    // Represents the difference between an empty player object and an object that a player has been loaded into

    public void SetupNewGame(int newSaveSlot)
    {
        saveSlot       = newSaveSlot;
        isPlayerLoaded = true;

        // TODO: CHANGE THIS BACK TO ZERO
        playerLevel    = 1;
        currentCredits = 1000000;

        ownedRunners = new List <CharacterData>();
        ownedHackers = new List <HackerData>();
        ownedItems   = new List <Item>();

        // Setup default runner
        currentRunner = ScriptableObject.CreateInstance <CharacterData>();
        currentRunner.CreateNewRunnerByClassId(0);
        currentRunner.UnlockRunner();
        ownedRunners.Add(currentRunner);
        ownedItems.AddRange(currentRunner.GetListOfEquippedItems());

        // Add placeholders for other runners
        CharacterData lockedRunnerOne = ScriptableObject.CreateInstance <CharacterData>();

        lockedRunnerOne.CreateNewRunnerByClassId(1);
        ownedRunners.Add(lockedRunnerOne);
        CharacterData lockedRunnerTwo = ScriptableObject.CreateInstance <CharacterData>();

        lockedRunnerTwo.CreateNewRunnerByClassId(2);
        ownedRunners.Add(lockedRunnerTwo);

        // Setup default hacker
        currentHacker = ScriptableObject.CreateInstance <HackerData>();
        currentHacker.CreateNewHackerByClassId(0);
        currentHacker.UnlockHacker();
        ownedHackers.Add(currentHacker);
        ownedItems.AddRange(currentHacker.GetListOfEquippedItems());

        // Add placeholders for other hackers
        HackerData lockedHackerOne = ScriptableObject.CreateInstance <HackerData>();

        lockedHackerOne.CreateNewHackerByClassId(1);
        ownedHackers.Add(lockedHackerOne);
        HackerData lockedHackerTwo = ScriptableObject.CreateInstance <HackerData>();

        lockedHackerTwo.CreateNewHackerByClassId(2);
        ownedHackers.Add(lockedHackerTwo);

        //RunnerMod adaptableCranioPatch = ScriptableObject.CreateInstance<RunnerMod>();
        //adaptableCranioPatch.SetupMod("Adaptable CranioPatch");
        ////adaptableCranioPatch.SetItemLevel(2);
        //ownedItems.Add(adaptableCranioPatch);

        //RunnerMod adrenalInjector = ScriptableObject.CreateInstance<RunnerMod>();
        //adrenalInjector.SetupMod("Adrenal Injector");
        //ownedItems.Add(adrenalInjector);

        //RunnerMod sensoryRegulator = ScriptableObject.CreateInstance<RunnerMod>();
        //sensoryRegulator.SetupMod("Sensory Regulator");
        //ownedItems.Add(sensoryRegulator);

        //RunnerMod automatedDigits = ScriptableObject.CreateInstance<RunnerMod>();
        //automatedDigits.SetupMod("Automated Digits");
        //ownedItems.Add(automatedDigits);

        //RunnerMod automatedDigitsTwo = ScriptableObject.CreateInstance<RunnerMod>();
        //automatedDigitsTwo.SetupMod("Automated Digits");
        //ownedItems.Add(automatedDigitsTwo);

        //RunnerMod polymorphicSupport = ScriptableObject.CreateInstance<RunnerMod>();
        //polymorphicSupport.SetupMod("Polymorphic Support");
        //ownedItems.Add(polymorphicSupport);

        //RunnerMod polymorphicSupportTwo = ScriptableObject.CreateInstance<RunnerMod>();
        //polymorphicSupportTwo.SetupMod("Polymorphic Support");
        //ownedItems.Add(polymorphicSupportTwo);

        //RunnerMod tornadoHandgun = ScriptableObject.CreateInstance<RunnerMod>();
        //tornadoHandgun.SetupMod("Tornado Handgun T-492");
        //ownedItems.Add(tornadoHandgun);

        //RunnerMod voltHandCannon = ScriptableObject.CreateInstance<RunnerMod>();
        //voltHandCannon.SetupMod("Volt HandCannon V-1");
        //ownedItems.Add(voltHandCannon);

        Loadout runnerLoadout = currentRunner.GetLoadout();

        //runnerLoadout.EquipItem(adaptableCranioPatch);
        //runnerLoadout.EquipItem(adrenalInjector);
        //runnerLoadout.EquipItem(sensoryRegulator);
        //runnerLoadout.EquipItem(automatedDigits, Loadout.LeftOrRight.Left);
        //runnerLoadout.EquipItem(automatedDigitsTwo, Loadout.LeftOrRight.Right);
        //runnerLoadout.EquipItem(polymorphicSupport, Loadout.LeftOrRight.Left);
        //runnerLoadout.EquipItem(polymorphicSupportTwo, Loadout.LeftOrRight.Right);
        //runnerLoadout.EquipItem(tornadoHandgun);
        //runnerLoadout.EquipItem(voltHandCannon);

        GenerateJobOptions();
        GenerateNewShop();
    }
Пример #11
0
 public void SetCurrentHacker(HackerData newHacker)
 {
     currentHacker = newHacker;
 }
 public void LoadHackTestOne()
 {
     currentRunner = playerData.GetCurrentRunner();
     currentHacker = playerData.GetCurrentHacker();
     LoadHack();
 }
Пример #13
0
 public void SetCharacterData(CharacterData characterToSet, HackerData hackerToSet)
 {
     character = characterToSet;
     hacker    = hackerToSet;
 }
 public void SetCharacterData(CharacterData newRunner, HackerData newHacker)
 {
     runner = newRunner;
     hacker = newHacker;
 }