Ejemplo n.º 1
0
    //
    // - - - Debug
    //

    /// <summary>
    /// generate ten instance of character descriptors for testing purposes
    /// </summary>
    private void DebugTestCharacter()
    {
        string        identity, descriptor;
        List <string> tempList = new List <string>();

        Debug.LogFormat("[Tst] AdventureManager.cs -> DebugTestCharacter: - - - - - - -{0}", "\n");
        for (int i = 0; i < 10; i++)
        {
            identity = descriptor = "";
            //special
            CharacterSpecial special = ToolManager.i.toolDataScript.GetCharacterSpecial();
            if (special != null)
            {
                //identity
                tempList = ToolManager.i.toolDataScript.GetCharacterIdentity();
                for (int j = 0; j < tempList.Count; j++)
                {
                    identity = string.Format("{0}{1}", identity.Length > 0 ? identity + ", " : "", tempList[j]);
                }
                //descriptor
                tempList = ToolManager.i.toolDataScript.GetCharacterDescriptors();
                for (int j = 0; j < tempList.Count; j++)
                {
                    descriptor = string.Format("{0}{1}", descriptor.Length > 0 ? descriptor + ", " : "", tempList[j]);
                }
                //output
                Debug.LogFormat("[Tst] Test {0}: {1} -> {2} -> {3}", i, special.tag, identity, descriptor, "\n");
            }
            else
            {
                Debug.LogWarning("Invalid CharacterSpecial (Null)");
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// returns a new character (no saving, just data collection)
    /// </summary>
    /// <returns></returns>
    public Character GetNewCharacter()
    {
        Character character = null;
        Random    random    = new Random();
        //special
        CharacterSpecial specialCharacter = ToolManager.i.toolDataScript.GetCharacterSpecial();

        if (specialCharacter != null)
        {
            switch (specialCharacter.special)
            {
            case SpecialType.None:
                character = GetNewPerson();
                break;

            case SpecialType.Organisation:
                character = GetNewOrganisation();
                break;

            case SpecialType.Object:
                character = GetNewObject();
                break;

            case SpecialType.OrgOrChar:
                // 50/50 chance of either
                if (random.Next(0, 100) < 50)
                {
                    character = GetNewPerson();
                }
                else
                {
                    character = GetNewOrganisation();
                }
                break;

            default: Debug.LogWarningFormat("Unrecognised specialType \"{0}\"", specialCharacter.special); break;
            }
        }
        else
        {
            Debug.LogWarning("Invalid CharacterSpecial (Null)");
        }
        return(character);
    }