コード例 #1
0
        private void SetStats()
        {
            detectiveName.text = detective.characterName;
            portrait.sprite    = detective.characterAvatar;
            sex.text           = string.Format("Sex: {0}", detective.sex.ToString());
            age.text           = string.Format("Age: {0}", detective.age.ToString());
            salary.text        = string.Format("Salary: {0} / week", detective.salary.ToString());
            health.text        = string.Format("Health: {0} {1}/{2}/{3}", detective.GetHealthDescription(), detective.minHealth, (int)detective.curHealth, detective.maxHealth);
            loyalty.text       = string.Format("Loyalty: {0}/{1}/{2}", detective.minLoyalty, (int)detective.curLoyalty, detective.maxLoyalty);
            confidence.text    = string.Format("Confidence: {0}/{1}/{2}", detective.minConfidence, (int)detective.curConfidence, detective.maxConfidence);
            // experience.text = string.Format("Experience: {0}/{1}/{2}", detective., (int)detective.curLoyalty, detective.maxLoyalty);
            stress.text     = string.Format("Stress: {0} {1}/{2}/{3}", detective.GetStressDescription(), detective.minStress, (int)detective.curStress, detective.maxStress);
            brutal.text     = string.Format("- {0}: {1} {2}/{3}", Method.Brutal.ToString(), detective.GetMethodDescription(Method.Brutal), detective.GetMethodValue(Method.Brutal), detective.GetMaxMethodValue(Method.Brutal));
            careful.text    = string.Format("- {0}: {1} {2}/{3}", Method.Accuracy.ToString(), detective.GetMethodDescription(Method.Accuracy), detective.GetMethodValue(Method.Accuracy), detective.GetMaxMethodValue(Method.Accuracy));
            diplomatic.text = string.Format("- {0}: {1} {2}/{3}", Method.Diplomacy.ToString(), detective.GetMethodDescription(Method.Diplomacy), detective.GetMethodValue(Method.Diplomacy), detective.GetMaxMethodValue(Method.Diplomacy));
            science.text    = string.Format("- {0}: {1} {2}/{3}", Method.Science.ToString(), detective.GetMethodDescription(Method.Science), detective.GetMethodValue(Method.Science), detective.GetMaxMethodValue(Method.Science));
            List <TraitContainer> traits = new List <TraitContainer>();

            for (int i = 0; i < traitPanel.childCount; i++)
            {
                TraitLine line = traitPanel.GetChild(i).GetComponent <TraitLine>();
                if (line != null)
                {
                    if (!detective.traits.Contains(line.trait))
                    {
                        Destroy(line.gameObject);
                    }
                    else
                    {
                        traits.Add(line.trait);
                    }
                }
            }
            foreach (TraitContainer trait in detective.traits)
            {
                if (trait.trait.category == TraitCategory.FENOTYPE)
                {
                    fenotype.text = string.Format("Fenotype: {0}", trait.trait.traitName);
                }
                else if (!traits.Contains(trait))
                {
                    TraitLine line = Instantiate(traitLine, traitPanel);
                    line.SetTrait(trait);
                }
            }
        }