private void Start() { if (randomCharisma == true) { //Debug.Log("Random charisma"); spawnEntitiesScript = FindObjectOfType <SpawnEntitiesAtRandom>(); if (spawnEntitiesScript != null) { startingCharisma = Random.Range(spawnEntitiesScript.takerMinChar, spawnEntitiesScript.takerMaxChar); } else { startingCharisma = Random.Range(minStartingCharisma, maxStartingCharisma); } GetComponent <SphereOfInfluence>().currentCharisma = startingCharisma; } else { Debug.Log("Inherited charisma"); } rigidbody = GetComponent <Rigidbody>(); startingPosition = transform.position; roamingPosition = GetRoamingPosition(); hitPointsManager = GetComponent <HitPointsManager>(); playParticleEffect = GetComponent <PlayParticleEffect>(); }
void Start() { spawnEntitiesScript = FindObjectOfType <SpawnEntitiesAtRandom>(); rigidbody = GetComponent <Rigidbody>(); attackSound = GetComponent <PlayRandomSound>(); navMeshAgent = GetComponent <NavMeshAgent>(); navMeshAgent.SetDestination(destination.position); gameManager = FindObjectOfType <GameManager>(); currentState = State.Idle; isClickable = false; overrideTarget = false; isTraitor = false; startBetrayal = false; isAttackTarget = false; isConversionTarget = false; leveledUp = false; attackCurrentTime = attackTimer; attackDamage = initialDamage; convertCooldown = initialConvertCooldown; // Generate random charisma. if (spawnEntitiesScript != null) { startingCharisma = Random.Range(spawnEntitiesScript.followerMinChar, spawnEntitiesScript.followerMaxChar); } else { startingCharisma = Random.Range(minStartingCharisma, maxStartingCharisma); } currentCharisma = startingCharisma; currentLoyalty = startingLoyalty; currentViolence = startingViolence; mainCamera = Camera.main; // Find the player. player = GameObject.FindGameObjectWithTag("Player"); agentCollider = GetComponent <Collider>(); ChangeMaterial(clothes, idleMaterial); ChangeMaterial(skin, skinMaterial); }