Get two different enums to change bool

So this is my two different scripts:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Population : MonoBehaviour
{
    public List<Person> personList;
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public class Person
{
    public enum PersonGender
    {
        Male,
        Female,
    }

    public PersonGender personGender;

    public int age;
    public int money;

    public bool gotLover;
    public bool pregnant;
    public bool adult;



}

So I want to make a function so that anytime a Male and Female can set the bool gotLover to True in the list on population. Any ideas?

void BecomeALoverNotAFighter( Person person)
 person.isLover = true;
}

More seriously, this isn’t really an answerable question.

My answer above is all anyone here on this forum can tell you.

All you have posted is data structures.

1 Like

I would probably change it so the Person class has a reference to another Person instance called Lover. Then if Lover is not null, that is equivalent to gotLover being true. Alternatively, I’d assign each Person instance a unique identifier, and have store the identifier of the lover. If the lover identifier is set, then the Person has a lover.

But without any of the code for how this data is actually being used, it is all speculation.

2 Likes