Large diffs are not rendered by default.

@@ -932,7 +932,7 @@ Transform:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1333979658223614}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
@@ -941,7 +941,7 @@ Transform:
- {fileID: 4050889172059672}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!4 &4359373242091158
Transform:
m_ObjectHideFlags: 1
@@ -999,16 +999,16 @@ Transform:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1771562894468854}
m_LocalRotation: {x: 0, y: -1, z: 0, w: 0}
m_LocalPosition: {x: -0, y: 0, z: 0}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4958433427737822}
- {fileID: 4372924302714688}
- {fileID: 4238602424076748}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: -180, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!4 &4495716308487854
Transform:
m_ObjectHideFlags: 1
@@ -18,7 +18,7 @@ void Start ()

if (camera != null)
{
camera.orthographicSize = aspectRatio > 1.5f ? 20.5f : 28.5f;
camera.orthographicSize = aspectRatio > 1.5f ? 24f : 31f;
}
}

@@ -13,13 +13,13 @@ public interface State

[Serializable]
public class WanderingState : State
{
public Vector3 aroundPosition;
private float wanderingDirectionChangePeriod;
private float wanderingDistance;
private float wanderingSpeed;
private NavMeshAgent agent;

{
public Vector3 aroundPosition;
private float wanderingDirectionChangePeriod;
private float wanderingDistance;
private float wanderingSpeed;
private NavMeshAgent agent;

public WanderingState(
Vector3 aroundPosition,
float wanderingDirectionChangePeriod,
@@ -33,46 +33,46 @@ public class WanderingState : State
this.wanderingSpeed = wanderingSpeed;
this.agent = agent;
}

public IEnumerator Enter()
{
agent.destination = aroundPosition;

float lastTime = Time.time;

while (true)
{
// One it reaches the previous destination, search for another randome place wehre to go
if (Mathf.Abs(Time.time - lastTime) > wanderingDirectionChangePeriod)
{
lastTime = Time.time;

var delta = UnityEngine.Random.rotation * Vector3.right * wanderingDistance;

agent.speed = wanderingSpeed;
agent.destination = aroundPosition + delta;
}

yield return null;
}
}

public void Exit()
{

public IEnumerator Enter()
{
agent.destination = aroundPosition;

float lastTime = Time.time;

while (true)
{
// One it reaches the previous destination, search for another randome place wehre to go
if (Mathf.Abs(Time.time - lastTime) > wanderingDirectionChangePeriod)
{
lastTime = Time.time;

var delta = UnityEngine.Random.rotation * Vector3.right * wanderingDistance;

agent.speed = wanderingSpeed;
agent.destination = aroundPosition + delta;
}

yield return null;
}
}

public void Exit()
{
}
}

[Serializable]
public class BlockState : State
{
public Transform target;
private float distanceThreadshold;
private NavMeshAgent agent;

public BlockState(
float distanceThreadshold,
Transform target,
NavMeshAgent agent
public Transform target;
private float distanceThreadshold;
private NavMeshAgent agent;

public BlockState(
float distanceThreadshold,
Transform target,
NavMeshAgent agent
)
{
this.distanceThreadshold = distanceThreadshold;
@@ -81,72 +81,72 @@ NavMeshAgent agent
}

public IEnumerator Enter()
{
agent.updateRotation = false;
{
agent.updateRotation = false;

var playerAgent = PlayerAgent.instance;

// Set the animator of the character as blocking
var animator = agent.GetComponentInChildren<Animator>();
if (animator != null)
{
//animator.SetBool("Blocking", true);
}

while (true)
{
var distance =
(target.transform.position - playerAgent.transform.position).sqrMagnitude;

// Rotate facing the player
var relativePos = playerAgent.transform.position - agent.transform.position;
var rotation = Quaternion.LookRotation(relativePos);
agent.transform.rotation = rotation;

// Tries to get in between the target and the player
if (distance < distanceThreadshold * distanceThreadshold)
{
agent.destination = Vector3.Lerp(
target.transform.position,
playerAgent.transform.position, 0.5f);
}
else
{
var direction = playerAgent.transform.position - target.transform.position;

agent.destination =
target.transform.position + direction.normalized * distanceThreadshold;

// Set the animator of the character as blocking
var animator = agent.GetComponentInChildren<Animator>();
if (animator != null)
{
//animator.SetBool("Blocking", true);
}

while (true)
{
var distance =
(target.transform.position - playerAgent.transform.position).sqrMagnitude;

// Rotate facing the player
var relativePos = playerAgent.transform.position - agent.transform.position;
var rotation = Quaternion.LookRotation(relativePos);
agent.transform.rotation = rotation;

// Tries to get in between the target and the player
if (distance < distanceThreadshold * distanceThreadshold)
{
agent.destination = Vector3.Lerp(
target.transform.position,
playerAgent.transform.position, 0.5f);
}
else
{
var direction = playerAgent.transform.position - target.transform.position;

agent.destination =
target.transform.position + direction.normalized * distanceThreadshold;
}

if (animator != null)
{
animator.SetBool("Blocking", distance < distanceThreadshold * distanceThreadshold * 2);
}

yield return null;
}
}

public void Exit()
{
agent.updateRotation = true;

// Set the animator of the character as blocking
var animator = agent.GetComponentInChildren<Animator>();
if (animator != null)
{
animator.SetBool("Blocking", false);
}
}

yield return null;
}
}

public void Exit()
{
agent.updateRotation = true;

// Set the animator of the character as blocking
var animator = agent.GetComponentInChildren<Animator>();
if (animator != null)
{
animator.SetBool("Blocking", false);
}
}
}

public class NextLightState : State
{
public MapItem light;
private AIAgent aiagent;
private NavMeshAgent agent;
private AIManager aimanager;

public MapItem light;
private AIAgent aiagent;
private NavMeshAgent agent;
private AIManager aimanager;

public NextLightState(
AIAgent aiagent,
NavMeshAgent agent,
@@ -158,32 +158,32 @@ AIManager aimanager
this.aimanager = aimanager;
}

public IEnumerator Enter()
{
agent.destination = agent.transform.position;

while (true)
{
public IEnumerator Enter()
{
agent.destination = agent.transform.position;

while (true)
{
light = aimanager.AssignMeALight(aiagent);
if (light != null)
{
agent.destination = light.transform.position;

while (agent.destination.XZ() != agent.transform.position.XZ())
{
yield return null;
}
{
agent.destination = light.transform.position;

while (agent.destination.XZ() != agent.transform.position.XZ())
{
yield return null;
}
}

yield return new WaitForSeconds(.5f);

aimanager.ReturnALight(aiagent);
}
}

public void Exit()
{
aimanager.ReturnALight(aiagent);

yield return new WaitForSeconds(.5f);

aimanager.ReturnALight(aiagent);
}
}

public void Exit()
{
aimanager.ReturnALight(aiagent);
}
}
}
@@ -54,5 +54,8 @@ void Awake()
{
tile.gameObject.SetActive(false);
}

instanceA.gameObject.SetActive(true);
instanceB.gameObject.SetActive(true);
}
}
Binary file not shown.