void Start() { movementRemaining = MAX_MOVEMENT; globalAttributes = gameObject.transform.parent.gameObject.GetComponent <EnemiesGlobalAttributes>(); anim = GetComponent <Animator>(); anim.SetInteger("selectedSpecies", globalAttributes.species); setPersona(); life += persona.Lifepoints; }
void Start() { anim = GetComponent <Animator>(); attributes = GetComponent <EnemiesAttributes>(); character = int.Parse(gameObject.name); float randomStart = Random.value * 3; InvokeRepeating("WanderOrStay", randomStart, 3); InvokeRepeating("HuntForFood", randomStart, 1); InvokeRepeating("FightCreatures", randomStart, 1); InvokeRepeating("DefendOrRun", randomStart, 0.5f); InvokeRepeating("EnemyBreed", randomStart, 5); agent = gameObject.GetComponent <NavMeshAgent>(); obstacle = gameObject.GetComponent <NavMeshObstacle>(); sprite = gameObject.GetComponent <SpriteRenderer>(); species = gameObject.transform.parent.GetComponent <EnemiesGlobalAttributes>().species; globalAttributes = gameObject.transform.parent.gameObject.GetComponent <EnemiesGlobalAttributes>(); persona = globalAttributes.persona; StartCoroutine(SetAgentOffset(1)); }