コード例 #1
0
ファイル: Character.cs プロジェクト: Grumpy-Kat/The100FanGame
    public Friendship GetFriendship(string charName)
    {
        for (int i = 0; i < friendships.Count(); i++)
        {
            if (friendships.Get(i).character1.characterName == charName)
            {
                return(friendships.Get(i));
            }
            if (friendships.Get(i).character2.characterName == charName)
            {
                return(friendships.Get(i));
            }
        }
        Character otherCharacter = GameObject.Find(charName).GetComponent <Character>();

        friendships.Add(new Friendship(this, otherCharacter, 0));
        otherCharacter.AddFriendship(friendships.Get(friendships.Count() - 1));
        return(friendships.Get(friendships.Count() - 1));
    }