Main Menu Rules
Started, should be finished in fact 👍
This commit is contained in:
parent
9a67bd00aa
commit
97aa74cacb
26 changed files with 2020 additions and 1 deletions
61
Assets/Scripts/UI/BehaviorChoice.cs
Normal file
61
Assets/Scripts/UI/BehaviorChoice.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class BehaviorChoice : MonoBehaviour
|
||||
{
|
||||
public GameObject chosenUnit;
|
||||
|
||||
|
||||
public void Neutral()
|
||||
{
|
||||
if (chosenUnit.GetComponent<OffensiveBehaviour>() != null)
|
||||
{
|
||||
Destroy(chosenUnit.GetComponent<OffensiveBehaviour>());
|
||||
}
|
||||
if (chosenUnit.GetComponent<DefensiveBehaviour>() != null)
|
||||
{
|
||||
Destroy(chosenUnit.GetComponent<DefensiveBehaviour>());
|
||||
}
|
||||
|
||||
if (chosenUnit.GetComponent<NeutralBehaviour>() == null)
|
||||
{
|
||||
chosenUnit.AddComponent<NeutralBehaviour>();
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void Offensive()
|
||||
{
|
||||
if (chosenUnit.GetComponent<NeutralBehaviour>() != null)
|
||||
{
|
||||
Destroy(chosenUnit.GetComponent<NeutralBehaviour>());
|
||||
}
|
||||
if (chosenUnit.GetComponent<DefensiveBehaviour>() != null)
|
||||
{
|
||||
Destroy(chosenUnit.GetComponent<DefensiveBehaviour>());
|
||||
}
|
||||
|
||||
if (chosenUnit.GetComponent<OffensiveBehaviour>() == null)
|
||||
{
|
||||
chosenUnit.AddComponent<OffensiveBehaviour>();
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void Defensive()
|
||||
{
|
||||
if (chosenUnit.GetComponent<NeutralBehaviour>() != null)
|
||||
{
|
||||
Destroy(chosenUnit.GetComponent<NeutralBehaviour>());
|
||||
}
|
||||
if (chosenUnit.GetComponent<OffensiveBehaviour>() != null)
|
||||
{
|
||||
Destroy(chosenUnit.GetComponent<OffensiveBehaviour>());
|
||||
}
|
||||
|
||||
if (chosenUnit.GetComponent<DefensiveBehaviour>() == null)
|
||||
{
|
||||
chosenUnit.AddComponent<DefensiveBehaviour>();
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue