コード例 #1
0
        /// <summary>
        /// Adds a partyMember to the list of partyMembers
        /// </summary>
        /// <param name="className"> Class of the partyMember to be added </param>
        public void AddPartyMember(string className)
        {
            if (GameManager.instance.gsDataCurrent.tutorialTriggers[(int)TutorialConstants.tutorialTriggers.isTutorial] == true && GetNumPartyMembers() == 1 && shouldStore == true)   // if in tutorial, the second partyMember joins later
            {
                storedPartyMember = className;
                shouldStore       = false;
            }
            else if (GetNumPartyMembers() < maxPartyMembers)
            {
                GameObject  newMember   = Instantiate(partyMember, new Vector3(0f, 0f, 0f), Quaternion.identity);
                PartyMember pmComponent = newMember.GetComponent <PartyMember>();
                GameManager.instance.DB.GetPartyMemberByClass(className, newMember.GetComponent <PartyMember>());
                newMember.transform.SetParent(gameObject.transform, false);
                pmComponent.ID = (ID++);
                pmComponent.GenerateName(GetNumPartyMembers());
                if (GameManager.instance.gsDataCurrent.tutorialTriggers[(int)TutorialConstants.tutorialTriggers.isTutorial] == true)
                {
                    pmComponent.LVLDown();
                }
                partyMembersAlive.Add(pmComponent);
                partyMembersAll.Add(pmComponent);
            }

            activePartyMember = GetFirstPartyMemberAlive();
        }