Example #1
0
        // Add new delt to party/bank, and deltdex if needed
        public void AddDelt(DeltemonClass newDelt)
        {
            // Add to deltdex if it is not present
            AddDeltDex(newDelt.deltdex);

            // Add to party/bank if party is full
            if (deltPosse.Count >= 6)
            {
                // Convert Delt to data and heal
                DeltemonData houseDelt = convertDeltToData(newDelt);
                houseDelt.health = houseDelt.stats[0];
                houseDelt.status = statusType.None;

                houseDelts.Add(houseDelt);
                SortHouseDelts();
            }
            else
            {
                DeltemonClass playerNewDelt = Instantiate(newDelt, this.transform);

                // Instantiate new Delt's moves so prefabs don't get altered
                foreach (MoveClass move in playerNewDelt.moveset)
                {
                    Instantiate(move, playerNewDelt.transform);
                }

                deltPosse.Add(playerNewDelt);
            }
        }
Example #2
0
        // Convert DeltClass to serializable data
        public DeltemonData convertDeltToData(DeltemonClass deltClass)
        {
            DeltemonData tempSave = new DeltemonData();

            tempSave.deltdexName = deltClass.deltdex.nickname;
            tempSave.nickname    = deltClass.nickname;
            tempSave.level       = deltClass.level;
            tempSave.AVCount     = deltClass.AVCount;
            tempSave.status      = deltClass.curStatus;
            tempSave.experience  = deltClass.experience;
            tempSave.XPToLevel   = deltClass.XPToLevel;
            tempSave.health      = deltClass.health;

            tempSave.stats[0] = deltClass.GPA;
            tempSave.stats[1] = deltClass.Truth;
            tempSave.stats[2] = deltClass.Courage;
            tempSave.stats[3] = deltClass.Faith;
            tempSave.stats[4] = deltClass.Power;
            tempSave.stats[5] = deltClass.ChillToPull;

            // Save accumulated stat values of delt
            for (int i = 0; i < 6; i++)
            {
                tempSave.AVs[i] = deltClass.AVs[i];
            }

            // Save item if delt has one
            if (deltClass.item != null)
            {
                tempSave.itemName = deltClass.item.itemName;
            }
            else
            {
                tempSave.itemName = null;
            }

            // Save each move and pp left of move
            for (int i = 0; i < deltClass.moveset.Count; i++)
            {
                MoveData newMove = new MoveData();
                newMove.moveName = deltClass.moveset[i].moveName;
                newMove.PPLeft   = deltClass.moveset[i].PPLeft;
                newMove.major    = deltClass.moveset[i].majorType.majorName;
                tempSave.moves.Add(newMove);
            }
            return(tempSave);
        }
Example #3
0
        // Switches PosseDelt into House, HouseDelt into Posse
        public void SwitchDelts()
        {
            hideMoveOverviews();

            DeltemonClass posseDelt = GameMan.deltPosse[PosseDeltIndex];

            DeltemonData posseToHouseDelt = GameMan.convertDeltToData(posseDelt);

            Button HouseLIButton, PosseLIButton;

            GameMan.houseDelts.Remove(queryResults[HouseDeltIndex]);
            GameMan.houseDelts.Add(posseToHouseDelt);
            GameMan.SortHouseDelts();
            GameMan.deltPosse[PosseDeltIndex] = HouseSwitchIn;

            // Destroy previous DeltemonClass at index
            Destroy(GameMan.transform.GetChild(PosseDeltIndex).gameObject);

            // Set House Switch In to persistent gameobject child on that index
            HouseSwitchIn.transform.SetParent(GameMan.transform);
            HouseSwitchIn.transform.SetSiblingIndex(PosseDeltIndex);

            // Remove overview
            HouseOverview.gameObject.SetActive(false);
            PosseOverview.gameObject.SetActive(false);

            HouseSwitchLI.transform.SetParent(PosseContentTransform);
            HouseSwitchLI.transform.SetSiblingIndex(PosseDeltIndex);
            HouseLIButton = HouseSwitchLI.GetComponentInChildren <Button>();
            HouseLIButton.onClick.RemoveAllListeners();
            AddListener(HouseLIButton, PosseDeltIndex, false);

            // Add removed Delt from posse to query, even if query doesn't fit (so user doesn't think their Delt disapppeared)
            queryResults.RemoveAt(HouseDeltIndex);
            if (isSearch)
            {
                queryResults.Add(posseToHouseDelt);
            }
            else
            {
                queryResults.Insert(GameMan.houseDelts.IndexOf(posseToHouseDelt), posseToHouseDelt);
            }

            int PTHIndex = queryResults.IndexOf(posseToHouseDelt);

            PosseSwitchLI.transform.SetParent(HouseContentTransform);
            PosseSwitchLI.transform.SetSiblingIndex(PTHIndex);
            PosseLIButton = PosseSwitchLI.GetComponentInChildren <Button>();

            int i = 0;

            foreach (Transform child in HouseContentTransform)
            {
                PosseLIButton = child.GetChild(6).GetComponent <Button>();
                PosseLIButton.onClick.RemoveAllListeners();
                AddListener(PosseLIButton, i, true);
                i++;
            }

            // Switch overviews
            SelectDeltForSwitch(PosseDeltIndex, false);
            SelectDeltForSwitch(PTHIndex, true);

            // Switch indexes
            HouseDeltIndex = PTHIndex;
        }
Example #4
0
        // Convert serializable data to DeltClass
        public DeltemonClass convertDataToDelt(DeltemonData deltSave, Transform parentObject)
        {
            GameObject    tmpDeltObject = Instantiate(emptyDelt, parentObject);
            DeltemonClass tmpDelt       = tmpDeltObject.GetComponent <DeltemonClass>();
            GameObject    deltDD        = (GameObject)Resources.Load("Deltemon/DeltDex/" + deltSave.deltdexName + "DD");

            tmpDeltObject.name = deltSave.nickname;

            tmpDelt.deltdex    = deltDD.GetComponent <DeltDexClass>();
            tmpDelt.nickname   = deltSave.nickname;
            tmpDelt.level      = deltSave.level;
            tmpDelt.AVCount    = deltSave.AVCount;
            tmpDelt.curStatus  = deltSave.status;
            tmpDelt.experience = deltSave.experience;
            tmpDelt.XPToLevel  = deltSave.XPToLevel;
            tmpDelt.health     = deltSave.health;

            tmpDelt.GPA         = deltSave.stats[0];
            tmpDelt.Truth       = deltSave.stats[1];
            tmpDelt.Courage     = deltSave.stats[2];
            tmpDelt.Faith       = deltSave.stats[3];
            tmpDelt.Power       = deltSave.stats[4];
            tmpDelt.ChillToPull = deltSave.stats[5];

            // Return status image
            switch (tmpDelt.curStatus)
            {
            case statusType.DA:
                tmpDelt.statusImage = statuses[0];
                break;

            case statusType.Roasted:
                tmpDelt.statusImage = statuses[1];
                break;

            case statusType.Suspended:
                tmpDelt.statusImage = statuses[2];
                break;

            case statusType.High:
                tmpDelt.statusImage = statuses[3];
                break;

            case statusType.Drunk:
                tmpDelt.statusImage = statuses[4];
                break;

            case statusType.Asleep:
                tmpDelt.statusImage = statuses[5];
                break;

            case statusType.Plagued:
                tmpDelt.statusImage = statuses[6];
                break;

            case statusType.Indebted:
                tmpDelt.statusImage = statuses[7];
                break;

            default:
                tmpDelt.statusImage = statuses[8];
                break;
            }

            // Restore accumulated stat values of delt
            for (int index = 0; index < 6; index++)
            {
                tmpDelt.AVs[index] = deltSave.AVs[index];
            }

            // Save item if delt has one
            if ((deltSave.itemName != null) && (deltSave.itemName != ""))
            {
                GameObject deltItemObject = (GameObject)Instantiate(Resources.Load("Items/" + deltSave.itemName), tmpDeltObject.transform);
                ItemClass  deltItem       = deltItemObject.GetComponent <ItemClass>();
                deltItem.numberOfItem = 1;
                tmpDelt.item          = deltItem;
            }
            else
            {
                tmpDelt.item = null;
            }
            foreach (MoveData move in deltSave.moves)
            {
                GameObject newMoveObject = (GameObject)Instantiate(Resources.Load("Moves/" + move.major + "/" + move.moveName), tmpDeltObject.transform);
                MoveClass  newMove       = newMoveObject.GetComponent <MoveClass>();
                tmpDelt.moveset.Add(newMove);
            }
            return(tmpDelt);
        }