Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions Assets/CONTENT/Programming/EnemyRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class EnemyRunner : MonoBehaviour
// Internal Logic
Action randomAction;

// Added Variables
float currentSpeed;

/*
* Please do not modify anything but the sections between the /// comments!
Expand All @@ -30,6 +32,30 @@ public void EnemyUpdate_Example_B()
enemyRB.MovePosition(Vector3.MoveTowards(transform.position, player.transform.position, 2f * Time.deltaTime));
}

public void EnemyUpdate_Erik()
{
//enemyRB.gravityScale = 0;
//float speedRandomizer = UnityEngine.Random.Range(0.9F, 1.1F);
//currentSpeed *= speedRandomizer;

enemyRB.MovePosition(Vector3.MoveTowards(transform.position, player.transform.position, currentSpeed * Time.deltaTime));

int coinFlip = UnityEngine.Random.Range(0, 2);
Vector3 scaler = new Vector3(0, 0, 0);
int maxSize = 3;

if (coinFlip == 0 && transform.localScale.x < maxSize)
{
scaler = new Vector3(0.1F, 0.1F, 0);
}
else if (coinFlip == 1 && transform.localScale.x >= maxSize)
{
scaler = new Vector3(-0.1F, -0.1F, 0);
}

transform.localScale += scaler;
}

/// ADD YOUR SCRIPT ABOVE! ------------------------


Expand All @@ -42,8 +68,13 @@ private void Start()
var list = new List<Action>();

/// ADD YOUR SCRIPT BELOW TO ADD!
list.Add(EnemyUpdate_Example_A);
list.Add(EnemyUpdate_Example_B);
//list.Add(EnemyUpdate_Example_A);
//list.Add(EnemyUpdate_Example_B);

enemyRB.gravityScale = 0;
currentSpeed = 5;
list.Add(EnemyUpdate_Erik);

/// ADD YOUR SCRIPT ABOVE TO ADD!

var randomIndex = UnityEngine.Random.Range(0, list.Count);
Expand Down