Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Boite : MonoBehaviour
- {
- public bool hasClient;
- // Client data
- public SessionType desiredSessionType;
- public Attribute desiredAttribute;
- public int desiredHostessCount;
- public float desiredSessionTime;
- // Session data
- public List<Hostess> currentHostesses = new List<Hostess>();
- public SessionType currentSessionType;
- public float currentSatisfaction;
- public float currentSessionTime;
- private void Update()
- {
- if (hasClient)
- {
- float score = 0;
- // Client is unhappy if count does not match.
- if (currentHostesses.Count != desiredHostessCount)
- {
- score -= 5;
- }
- // Client is unhappy if session does not match.
- if (desiredSessionType != currentSessionType)
- {
- score -= 3;
- }
- // Client is happy or unhappy based on attributes and skill.
- for (int i = 0; i < currentHostesses.Count; i++)
- {
- Hostess hostess = currentHostesses[i];
- if (hostess.Attribute == desiredAttribute)
- {
- score += 5;
- }
- // Other stuff like hostess skill and such
- }
- // Add the score to the satisfaction of the client each frame.
- currentSatisfaction += score * Time.deltaTime;
- // End session when time is up
- currentSessionTime += Time.deltaTime;
- if (currentSessionTime > desiredSessionTime)
- {
- EndSession();
- }
- }
- else
- {
- // Add a timer for the spawn of a client or something
- GenerateNewClientAndStartSession();
- }
- }
- private void GenerateNewClientAndStartSession()
- {
- hasClient = true;
- currentSessionTime = 0;
- currentSatisfaction = 0;
- // Random stuff
- desiredHostessCount = Random.Range(1,2);
- desiredSessionTime = Random.Range(1,3) * 15;
- // 6 is the number of session types. This will pick a random one
- desiredSessionType = (SessionType)Random.Range(0, 6);
- // Same, 10 is the number of attributes
- desiredAttribute = (Attribute)Random.Range(0, 10);
- // Generate other stuff like appearance
- }
- private void EndSession()
- {
- hasClient = false;
- // Do score stuff
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement