Follow

Contact

Address

Canberra Technology Park, Watson ACT 2602

©2020 Picklock Games.

Sprint 5 – ‘The Hangover’

September 18, 2017

For the past sprint we have been building out the environment around the apartment and looking at a few assets to add detail to our game. Below you can see some of the building exterior created for around our apartment.

Using Probuilder we have been able to quickly create buildings to put in our environment to create a nice landscape if looking outside the apartment. Below we are making an apartment building from our street in Washington, this took about 45 minutes to complete.

Check out the time lapse of this process on our Instagram: Building – Time Lapse

We have been trying out a new third person control called Ultimate Third Person. It seems to be pretty powerful and the best bit is, it is really smooth. Here we are integrating this code into our main build, including opening a door function.

The last thing we have been doing is building a NPC Script. Starting off with a basic tutorial we then enhanced that script to have both a patrol function. Where the NPC patrols between set way-points. A pursue function, where the NPC starts following the character when you come into range. Once leaving that range the NPC returns to patrolling. Lastly a stand still function, where if the NPC gets close enough to the character it standstills, thus ready for a conversation. You can see the NPC here patrolling.

 

The complete script is below. NPC Patrol, Pursue, Standstill class:

 

public class chase : MonoBehaviour {

public Transform player;

Animator anim;

string state = "patrol";

public GameObject[] waypoints;

int currentWP = 0;

float rotSpeed = 1f;

//float speed = 3f;

float accuracyWP = 2.0f;

 

// Use this for initialization

void Start ()

{

 anim = GetComponent ();

}

//patrol method

void Patrol(Vector3 direction)

{

if (Vector3.Distance (waypoints [currentWP].transform.position, transform.position) = waypoints.Length)

{

  currentWP = 0;

 }

}

direction = waypoints [currentWP].transform.position - transform.position;

this.transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation (direction), 0.1f);

this.transform.Translate (0, 0, 0.05f);

}

 

//pursue method

void Pursue(Vector3 direction)

{

this.transform.rotation = Quaternion.Slerp (this.transform.rotation, Quaternion.LookRotation (direction), 0.1f);

//Slerp makes a smooth turn

 

this.transform.Translate (0, 0, 0.05f);

anim.SetFloat ("Forward Input", 1f);

 

}

 

void Standstill()

{

 anim.SetFloat ("Forward Input", 0f);

}

 

// Update is called once per frame

void Update ()

{

Vector3 direction = player.position - this.transform.position;

//Works out the distance

direction.y = 0;

//stops them falling over on the Y axis

anim.SetFloat ("Forward Input", 1f);

//anim.SetFloat ("Forward Input", 1f);

 

//if to far away patrol, if close pursue

if (Vector3.Distance (player.position, this.transform.position) > 3) {

Patrol (direction);

}else if (Vector3.Distance (player.position, this.transform.position) < 1){

Standstill ();

}

else {

Pursue (direction);

  }

}

}

 

 

Lastly want to say a big thank you to all our followers as we hit 1000 on Instagram!

 

Till next time.

Please reload

Recent Posts

September 22, 2018

September 11, 2018

Please reload

Archive

Please reload

Tags

Please reload