AI Personality Demo
A small demo made to showcase how one can easily add personality to a game AI through dialogue.
Status | Prototype |
Platforms | HTML5 |
Author | clockhound |
Made with | Unity |
A small demo made to showcase how one can easily add personality to a game AI through dialogue.
Status | Prototype |
Platforms | HTML5 |
Author | clockhound |
Made with | Unity |
Comments
Log in with itch.io to leave a comment.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GMScript : MonoBehaviour {
public Text frogBondTxt;
public Text lizardBondTxt;
public Text dialogueTxt;
public int frogBond, lizardBond, bond;
public bool isFrog, inMenu, personality;
FrogDialogue frogLines;
LizardDialogue lizardLines;
void Start () {
frogLines = GetComponent<FrogDialogue>();
lizardLines = GetComponent<LizardDialogue>();
personality = false;
frogBond = 0;
lizardBond = 0;
dialogueTxt.text = "";
}
void Update () {
frogBondTxt.text = "Bond: " + frogBond;
lizardBondTxt.text = "Bond: " + lizardBond;
}
public void PersonalityTime()
{
if (personality)
{
personality = false;
frogLines.PersonalityToggle(false);
lizardLines.PersonalityToggle(false);
print("no personality!");
}
else
{
personality = true;
frogLines.PersonalityToggle(true);
lizardLines.PersonalityToggle(true);
print("yes personality!");
}
}
public void BondUpdate (int amount)
{
if (isFrog)
{
frogBond = frogBond + amount;
bond = frogBond;
}
else
{
lizardBond = lizardBond + amount;
bond = lizardBond;
}
}
public void GiveTribute ()
{
if (isFrog)
{
dialogueTxt.text = frogLines.tribute;
BondUpdate(1);
}
else
{
dialogueTxt.text = lizardLines.tribute;
BondUpdate(1);
}
}
public void DoQuest ()
{
if (bond < 1)
{
if (isFrog)
{
dialogueTxt.text = frogLines.questReject;
}
else
{
dialogueTxt.text = lizardLines.questReject;
}
}
else
{
BondUpdate(5);
if (isFrog)
{
dialogueTxt.text = frogLines.questAccept;
}
else
{
dialogueTxt.text = lizardLines.questAccept;
}
}
}
public void AskFavor ()
{
if (bond < 2)
{
if (isFrog)
{
dialogueTxt.text = frogLines.favorAngryReject;
}
else
{
dialogueTxt.text = lizardLines.favorAngryReject;
}
BondUpdate(-2);
}
else if (bond < 7)
{
if (isFrog)
{
dialogueTxt.text = frogLines.favorReject;
}
else
{
dialogueTxt.text = lizardLines.favorReject;
}
}
else
{
if (isFrog)
{
dialogueTxt.text = frogLines.favorAccept;
}
else
{
dialogueTxt.text = lizardLines.favorAccept;
}
}
}
public void FrogTalk()
{
isFrog = true;
bond = frogBond;
dialogueTxt.text = frogLines.greeting;
}
public void LizardTalk ()
{
isFrog = false;
bond = lizardBond;
dialogueTxt.text = lizardLines.greeting;
}
public void Quit()
{
Application.Quit();
}
public void Reset ()
{
frogBond = 0;
lizardBond = 0;
bond = 0;
dialogueTxt.text = "";
}
}