Skip to content

Commit

Permalink
Balans AI.
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysiekKropka committed May 15, 2023
1 parent c893fc2 commit e455887
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 789 deletions.
709 changes: 0 additions & 709 deletions Assets/Prefabs/Dreamy.prefab

This file was deleted.

7 changes: 0 additions & 7 deletions Assets/Prefabs/Dreamy.prefab.meta

This file was deleted.

2 changes: 1 addition & 1 deletion Assets/Prefabs/DreamyUSE.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ PrefabInstance:
objectReference: {fileID: 21300000, guid: ae00216dea93f724591ebc07ce8360f5, type: 3}
- target: {fileID: 5891919148703806736, guid: f73d46feb27e5464594babe4b7eb4d24, type: 3}
propertyPath: speed
value: 6
value: 7
objectReference: {fileID: 0}
- target: {fileID: 5891919148703806736, guid: f73d46feb27e5464594babe4b7eb4d24, type: 3}
propertyPath: dropHP
Expand Down
3 changes: 2 additions & 1 deletion Assets/Prefabs/Enemy.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ MonoBehaviour:
DreamyDeath: {fileID: 8300000, guid: 5958a07866e649848baaf7f28917ad37, type: 3}
customHP: 0
maxHealth: 100
speed: 9
speed: 10
isStatic: 0
neverForget: 0
playerDetected: 0
rotationSpeed: 0.1
lockedRotationSpeed: 0.4
Expand Down
6 changes: 3 additions & 3 deletions Assets/Scenes/Lvl3.unity
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5891919148703806736, guid: f73d46feb27e5464594babe4b7eb4d24, type: 3}
propertyPath: speed
value: 10
value: 12
objectReference: {fileID: 0}
- target: {fileID: 5891919148703806736, guid: f73d46feb27e5464594babe4b7eb4d24, type: 3}
propertyPath: customHP
Expand Down Expand Up @@ -21840,7 +21840,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5891919148703806736, guid: f73d46feb27e5464594babe4b7eb4d24, type: 3}
propertyPath: speed
value: 10
value: 12
objectReference: {fileID: 0}
- target: {fileID: 5891919148703806736, guid: f73d46feb27e5464594babe4b7eb4d24, type: 3}
propertyPath: customHP
Expand Down Expand Up @@ -22132,7 +22132,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5891919148703806736, guid: f73d46feb27e5464594babe4b7eb4d24, type: 3}
propertyPath: speed
value: 10
value: 12
objectReference: {fileID: 0}
- target: {fileID: 5891919148703806736, guid: f73d46feb27e5464594babe4b7eb4d24, type: 3}
propertyPath: customHP
Expand Down
16 changes: 10 additions & 6 deletions Assets/Scripts/Enemy/AIBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class AIBrain : MonoBehaviour
public bool isStatic = false;

//Player detection related
public bool neverForget = false;
public bool playerDetected = false;
private bool playerWasDetected = false;
private bool seekingActivated;
Expand Down Expand Up @@ -153,9 +154,12 @@ public void PlayerInterrupts(bool onlySpeaker = true)
reactionCoroutine = ReactionTime(onlySpeaker);
StartCoroutine(reactionCoroutine);
}
forgetPlayerTimer = forgetPlayer;
stopFollowCoroutine = StopFollowing();
StartCoroutine(stopFollowCoroutine);
if(!neverForget)
{
forgetPlayerTimer = forgetPlayer;
stopFollowCoroutine = StopFollowing();
StartCoroutine(stopFollowCoroutine);
}
}

public void ChangeAimLock(bool aimedAtPlayer = false)
Expand Down Expand Up @@ -206,7 +210,7 @@ public void TakeDamage(int damage)
{
player.SetXP(dropXP);
player.AddKill();
if (isDreamy) AudioSource.PlayClipAtPoint(DreamyDeath, transform.position);
if (isDreamy) AudioSource.PlayClipAtPoint(DreamyDeath, transform.position, 2f);
}
Instantiate(bloodPoolEffect, transform.position, Quaternion.identity);
GameObject droppedMoney = Instantiate(moneyDropPrefab, transform.position + new Vector3(-0.75f, -0.75f, 0f), Quaternion.identity);
Expand All @@ -231,7 +235,7 @@ IEnumerator ReactionTime(bool onlySpeaker = true)
yield return new WaitForSeconds(reactionTime);
reacting = false;
if (!isDreamy && onlySpeaker) healthBar.Dialogue(FoundPlayerDialogue[Random.Range(0, FoundPlayerDialogue.Length)]);
else if (isDreamy) AudioSource.PlayClipAtPoint(DreamyFind, transform.position);
else if (isDreamy) AudioSource.PlayClipAtPoint(DreamyFind, transform.position, 2f);
seekingActivated = false;
playerDetected = true;
playerWasDetected = true;
Expand All @@ -243,7 +247,7 @@ IEnumerator StopFollowing()
playerDetected = false;
ChangeAimLock(false);
if (!isDreamy) healthBar.Dialogue(SeekPlayerDialogue[Random.Range(0, SeekPlayerDialogue.Length)]);
else AudioSource.PlayClipAtPoint(DreamySeek, transform.position);
else AudioSource.PlayClipAtPoint(DreamySeek, transform.position, 2f);
if (seekPlayerCoroutine != null) StopCoroutine(seekPlayerCoroutine);
seekPlayerCoroutine = SeekingPlayer();
StartCoroutine(seekPlayerCoroutine);
Expand Down
12 changes: 6 additions & 6 deletions Assets/Scripts/Misc/EnemySpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,19 @@ IEnumerator SpawnerRoutine()
int randomSpawner = Random.Range(0, enemySpawners.Length);
int randomChance = Random.Range(0, 40);

GameObject enemy;

if (randomChance == 39 && dreamySpawn)
{
GameObject enemy = Instantiate(DreamyPrefab, enemySpawners[randomSpawner].position, Quaternion.identity);
enemy.transform.GetChild(0).rotation = enemySpawners[randomSpawner].rotation;
enemy.transform.GetChild(0).GetComponent<AIBrain>().PlayerInterrupts();
enemy = Instantiate(DreamyPrefab, enemySpawners[randomSpawner].position, Quaternion.identity);
}
else
{
GameObject enemy = Instantiate(EnemyPrefab, enemySpawners[randomSpawner].position, Quaternion.identity);
enemy.transform.GetChild(0).rotation = enemySpawners[randomSpawner].rotation;
enemy = Instantiate(EnemyPrefab, enemySpawners[randomSpawner].position, Quaternion.identity);
enemy.GetComponent<AIShooting>().equippedWeaponID = randomWeapon;
enemy.transform.GetChild(0).GetComponent<AIBrain>().PlayerInterrupts();
}
enemy.transform.GetChild(0).GetComponent<AIBrain>().neverForget = true;
enemy.transform.GetChild(0).GetComponent<AIBrain>().PlayerInterrupts();
}
yield return new WaitForSeconds(spawnInterval);
}
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Player/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void Dash()
isDashing = true;
isInvincible = true;
trailRenderer.emitting = true;
remainingStamina -= 4f;
remainingStamina -= 2.5f;
AudioSource.PlayClipAtPoint(dashClip, transform.position, 1f);
}
else if (dashingSpree < 2)
Expand All @@ -198,7 +198,7 @@ void Dash()
isDashing = true;
isInvincible = true;
trailRenderer.emitting = true;
remainingStamina -= 4f;
remainingStamina -= 2.5f;
AudioSource.PlayClipAtPoint(dashClip, transform.position, 1f);
if(dashingSpree >= 2)
{
Expand Down
3 changes: 2 additions & 1 deletion Assets/Scripts/Player/Shooting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,12 @@ IEnumerator Shoot()

for (int i=0; i< firePointShotgun.Length; i++)
{
int damageShotgun = Random.Range(weaponDamage[equippedWeaponID] - 5, weaponDamage[equippedWeaponID] + 3);
bullets[i] = Instantiate(bulletPrefab, firePointShotgun[i].position, Quaternion.Euler(firePointShotgun[i].rotation.eulerAngles + spread));
Bullet bulletsScript = bullets[i].GetComponent<Bullet>();
bulletsScript.weaponID = null;
bulletsScript.playerIsOwner = true;
bulletsScript.bulletDamage = damage;
bulletsScript.bulletDamage = damageShotgun;
rbs[i] = bullets[i].GetComponent<Rigidbody2D>();
rbs[i].AddForce(bullets[i].transform.up * bulletForce, ForceMode2D.Impulse);
Destroy(bullets[i], 10);
Expand Down
16 changes: 8 additions & 8 deletions UserSettings/EditorUserSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ EditorUserSettings:
value: 560802500103505f095e5a2140725b44444e497f7979713228784861b0e5356e
flags: 0
RecentlyUsedSceneGuid-2:
value: 5409065601540a5a5a5b557b15715d44404e1c7f287925327a7d1866e3e56c3b
value: 5a090c5106505002080d0a234627084412164a79287870337c711e65e7e2366a
flags: 0
RecentlyUsedSceneGuid-3:
value: 050756525c515f0d0e5d082314220644104e4c782e2a24607e7c1f36b6e6646c
value: 51550252040c5b030e0b54704525594413151e7d7f7d77692c714937bab6356b
flags: 0
RecentlyUsedSceneGuid-4:
value: 5a090c5106505002080d0a234627084412164a79287870337c711e65e7e2366a
value: 0603515e030d0f0e0b0d552747770e444715412e7d7b7761292a4a66b5e2326a
flags: 0
RecentlyUsedSceneGuid-5:
value: 51550252040c5b030e0b54704525594413151e7d7f7d77692c714937bab6356b
value: 5a000c5053540b580b0d5e7b13715e44454f4e7a2f2d72627d2a4861b7e1353b
flags: 0
RecentlyUsedSceneGuid-6:
value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661
value: 0703000354510a035d0a5d7742720844454f4b72287f75687e7a4866b0b9633c
flags: 0
RecentlyUsedSceneGuid-7:
value: 0603515e030d0f0e0b0d552747770e444715412e7d7b7761292a4a66b5e2326a
value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661
flags: 0
RecentlyUsedSceneGuid-8:
value: 5a000c5053540b580b0d5e7b13715e44454f4e7a2f2d72627d2a4861b7e1353b
value: 5409065601540a5a5a5b557b15715d44404e1c7f287925327a7d1866e3e56c3b
flags: 0
RecentlyUsedSceneGuid-9:
value: 0703000354510a035d0a5d7742720844454f4b72287f75687e7a4866b0b9633c
value: 050756525c515f0d0e5d082314220644104e4c782e2a24607e7c1f36b6e6646c
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
Expand Down
Loading

0 comments on commit e455887

Please sign in to comment.