Esempio n. 1
0
        /// <summary>
        /// Adds a partyMember to the list of partyMembers using saved data
        /// </summary>
        /// <param name="className"> Class of the partyMember to be added </param>
        public void AddPartyMember(PartyMemberData pmData)
        {
            if (GetNumPartyMembers() < maxPartyMembers)
            {
                GameObject  newMember   = Instantiate(partyMember, new Vector3(0f, 0f, 0f), Quaternion.identity);
                PartyMember pmComponent = newMember.GetComponent <PartyMember>();
                pmComponent.Init(pmData);
                newMember.transform.SetParent(gameObject.transform, false);
                pmComponent.ID = (ID++);
                pmComponent.GenerateName(GetNumPartyMembers());
                if (pmComponent.CHP == 0)
                {
                    partyMembersDead.Add(pmComponent);
                }
                else
                {
                    partyMembersAlive.Add(pmComponent);
                }
                partyMembersAll.Add(pmComponent);
            }

            if (partyMembersAlive.Count == 0)   // in the event on loading, first partyMember is dead
            {
                activePartyMember = partyMembersAll[0];
            }
            else
            {
                activePartyMember = GetFirstPartyMemberAlive();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Returns partyMember data for saving
        /// </summary>
        /// <returns></returns>
        public PartyMemberData[] GetPartyMemberDatas()
        {
            PartyMemberData[] partyMemberDatas;
            partyMemberDatas = new PartyMemberData[partyMembersAll.Count];

            for (int i = 0; i < partyMemberDatas.Length; i++)
            {
                partyMemberDatas[i] = new PartyMemberData(partyMembersAll[i]);
            }

            return(partyMemberDatas);
        }