//Find a solution for this problem void TargetDestroyed(GameObject GO) { if (CurrentAction != null) { if (GO == CurrentAction.CurrentActionTarget) { CurrentAction = new WaitAction(this, gameObject, 5); CurrentState = ActionState.Idle; } } else if (GO.GetComponent <Building> ().IsOnFire) { if (WorldObjects.BuildingsOnFire.Contains(GO)) { WorldObjects.BuildingsOnFire.Remove(GO); } } }
public virtual void GetNewTask() { if (stats.MoneyAmount <= 5) { CurrentAction = new BuyFromStore(this, FindObjectOfType <Building_Normal_Service_Bank>()); return; } var rand = Random.Range(1, 3); if (rand == 1) { CurrentState = ActionState.Talking; } if (rand == 2) { CurrentState = ActionState.Idle; } }
void Awake() { anim = GetComponentInChildren <Animator> (); stats = GetComponent <CitizenStats> (); if (SceneManager.GetActiveScene().name == "CharacterGenerationTest") { CurrentState = ActionState.Test; } else { CurrentState = ActionState.Idle; CurrentAction = null; //Only do this for testing purposes if (!WorldObjects.ActivePeople.Contains(gameObject)) { WorldObjects.ActivePeople.Add(gameObject); } } if (CurrentState == ActionState.Test) { anim.enabled = false; } }