Thursday, 2 May 2013

Following AI code update

Hope we have fixed the ai circling bug with this snippet of code.
if we change this part of the previous code

//move towards the player
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;

to:


//move towards the player if not too close

if ( ( myTransform.position - target.position ).sqrMagnitude > 4F )
{

myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;

}
 
it should only move towards the player if the player is a certain distance away so it should in theory stop moving all together if it is so many units close to the player.

Wednesday, 1 May 2013

ColourFilterControl script


public var cameraNormal : GameObject;
public var cameraRed : GameObject;
public var cameraBlue : GameObject;
public var cameraOrange : GameObject;
public var SWITCH_TO_NORMAL_CAMERA_TIME : float = 10;
public class ColorFilterControl extends MonoBehaviour
{
 public static var Instance : ColorFilterControl = null;
 public function SwitchToRedCamera()
 {
  CancelInvoke("SwitchToNormalCamera");
 
  cameraNormal.SetActive(false);
  cameraRed.SetActive(true);
  cameraBlue.SetActive(false);
  cameraOrange.SetActive(false);
 
  Invoke("SwitchToNormalCamera", SWITCH_TO_NORMAL_CAMERA_TIME );
 }

 public function SwitchToBlueCamera()
 {
  CancelInvoke("SwitchToNormalCamera");
 
  cameraNormal.SetActive(false);
  cameraRed.SetActive(false);
  cameraBlue.SetActive(true);
  cameraOrange.SetActive(false);
 
  Invoke("SwitchToNormalCamera", SWITCH_TO_NORMAL_CAMERA_TIME );
 }

 public function SwitchToOrangeCamera()
 {
  CancelInvoke("SwitchToNormalCamera");
 
  cameraNormal.SetActive(false);
  cameraRed.SetActive(false);
  cameraBlue.SetActive(false);
  cameraOrange.SetActive(true);
 
  Invoke("SwitchToNormalCamera", SWITCH_TO_NORMAL_CAMERA_TIME );
 }

 public function SwitchToNormalCamera()
 {
  cameraNormal.SetActive(true);
  cameraRed.SetActive(false);
  cameraBlue.SetActive(false);
  cameraOrange.SetActive(false);
 }


 function Awake()
 {
  if ( Instance != null )
  {
   Destroy (this );
  }
  else
  {
   Instance = this;
  }

 }

 function Start ()
 {
  SwitchToNormalCamera();
 }

}

PickUp fruit - initiate effect code


#pragma strict
public enum ColorFilterType { normal, red, blue, orange };
public var colorSwitcher : ColorFilterType;
function OnTriggerEnter (other : Collider)
{
 renderer.enabled = false;

 switch ( colorSwitcher )
 {
  case ColorFilterType.normal:
 
   ColorFilterControl.Instance.SwitchToNormalCamera();
   break;
  
  case ColorFilterType.red:
 
   ColorFilterControl.Instance.SwitchToRedCamera();
   break;
  case ColorFilterType.blue:
 
   ColorFilterControl.Instance.SwitchToBlueCamera();
   break;
  
  case ColorFilterType.orange:
 
   ColorFilterControl.Instance.SwitchToOrangeCamera();
   break;  
 }
 
 yield WaitForSeconds (8);
 renderer.enabled = true;
}
/*function update();
{
 if (renderer.enabled = false)
*/

Sound

sound is on the way, collected the set we agreed on, however, a small problem. (dont owrry its not going to stop is uts just a basic one) the audeo files are in diforent formats, like IFF and so on, however i also need to know what type of audeo file Unity uses so that i dont wait stime converting the audeo files to like MP3 or something and all of a sudden being told we need IFF or something like that.

in a nutshell, there ready, just need to know what they need to be converted too.

Monday, 29 April 2013

Beacon pickup / rotate code

using UnityEngine;
using System.Collections;
public class Pickup : MonoBehaviour {
 // Use this for initialization
 void Start () {

 }

 public float rotationSpeed = 100.0f;
 // Update is called once per frame
 void Update () {
 transform.Rotate(new Vector3 (0,rotationSpeed * Time.deltaTime, 0));
 }

 void OnTriggerEnter(Collider col){
 if(col.gameObject.tag == "Player"){
   col.gameObject.SendMessage("CellPickup");
   Destroy(gameObject);
  }
}
}

Friday, 26 April 2013

Texturing

found a useful tutorial on texturing for all of us, probably worth a look at wether your an expert or not.

in a nutshell, it hightlight triks and tips on texturing, so for exampile, how can you create a rust effect in a seccond rather than spending hours perfecting it.

hear is the link: http://forums.cgsociety.org/showthread.php?t=373024

Audio and Adobe Audition

OK so i think it about time to show what we will be facing in turms of Audio. So i did some resurch to see what we where up against and so i have come to the conclution below.


Sound effects, while some of it can be edited in Adobe Audition for effects (faid in and faid out and so on) achaly recording the Audio in the first place will prove a challenge. for exampole, while recording can be acheved through a sympole basic micraphone, removing background could prove challenging depending on the sound.

Adobe Audition had a very effective tool of removing the noise but for longer Audio this could prove time consuming as well as frustrating if something where to go wrong. how this works is that Audition creats a sort of "Thermal Imige" of the audio and allows the user to highlight and deleat arias of the audeo, this is created by what freqensies it can pik up and split them up, however, it can be a problem if an unwanted sound where to be present at the same freqency and the sound we would want, there for it not only would it be hiddent, it would be alot harder to remove, not to mention the audio would be changed with the content of the audio we would want, which would be problamatic.

So... in a Nutshell... well have to stick with the basics it would seem. althogh, i do beleve that we have time for the basic effects for the game.

Light/ Colour Script

using UnityEngine;
using System.Collections;

public class DoorControl : MonoBehaviour {

 public bool toggleDoor = false;

 private bool doorOpen = false;
 private const string strOpen = "Open";
 private const string strClose = "Close";

 public TextMesh counterTM;
 private int counter = 0;

 public Light redLight;
 public Light blueLight;
 public Light greenLight;
 public Light orangeLight;

 public int currentCycleState = NONE;
 public float nextCycleTime = 0f;
 public bool enableCyclingOfLights = false;

 //public int countTo4 = 0;

 // Use this for initialization
 void Start () {

 }

 // Update is called once per frame
 void Update ()
 {

  if ( enableCyclingOfLights )
  {
   if ( nextCycleTime < Time.time )
  
   {
   CycleEachLight();
  
   }
  }


  else if (toggleDoor)
  {
   doorOpen = !doorOpen;
 
   if (doorOpen)
   {
    animation.Play(strOpen);
    counter++;
    counterTM.text = counter.ToString ();
  
    // when door is opened and the counter changes
    // check if the lights need to be changed
    UpdateLightsStates( counter );

   }
   else
   {
    animation.Play(strClose);
    counterTM.text = "Closing Door";
   }

   toggleDoor = false;
 
  }
 }

 void CycleEachLight()
 {

  switch ( currentCycleState )
  {
   case NONE:
    SwitchLightOn ( RED );
    currentCycleState = RED;
    nextCycleTime = Time.time + 2f;
    break;
 
   case RED:
    SwitchLightOn ( ORANGE );
    currentCycleState = ORANGE;
    nextCycleTime = Time.time + 2f;
    break;
 
   case ORANGE:
    SwitchLightOn ( GREEN );
    currentCycleState = GREEN;
    nextCycleTime = Time.time + 2f;
    break;
 
   case GREEN:
    SwitchLightOn ( BLUE );
    currentCycleState = BLUE;
    nextCycleTime = Time.time + 2f;
    break;
 
   case BLUE:
    currentCycleState = NONE;
    enableCyclingOfLights = false;
    counter = 0;
    break;
 
 
  }


 }

 void UpdateLightsStates ( int count )
 {
  switch ( count )
  {
   case 2:
    SwitchLightOn ( RED );
    break;
 
   case 4:
    SwitchLightOn ( ORANGE );
    break;
 
   case 7:
    SwitchLightOn ( GREEN );
    break;
 
   case 9:
    SwitchLightOn ( BLUE );
    break;
 
   case 10:
    enableCyclingOfLights = true;
 
    break;
  }



 }

 private const int NONE = 0;
 private const int RED = 1;
 private const int ORANGE = 2;
 private const int GREEN = 3;
 private const int BLUE = 4;


 void SwitchLightOn( int lightToSwitchOn )
 {
  switch ( lightToSwitchOn )
  {
   case RED:
    redLight.enabled = true;
    orangeLight.enabled = false;
    greenLight.enabled = false;
    blueLight.enabled = false;
    break;
 
   case ORANGE:
    orangeLight.enabled = true;
    redLight.enabled = false;
    greenLight.enabled = false;
    blueLight.enabled = false;
    break;
 
   case GREEN:
    greenLight.enabled = true;
    orangeLight.enabled = false;
    redLight.enabled = false;
    blueLight.enabled = false;
    break;
 
   case BLUE:
    blueLight.enabled = true;
    greenLight.enabled = false;
    orangeLight.enabled = false;
    redLight.enabled = false;
    break;
 
 
 
  default:
   //catch all condition
   blueLight.enabled = false;
   greenLight.enabled = false;
   orangeLight.enabled = false;
   redLight.enabled = false;
   break;
 
  }

 }

}

Here is some code Toop and I were thinking of using to make the scene change colour. When you hit the plant, it will make everything that colour.

Title Screen

 
 We desided to make a title screen as all games have one so use uead the textures that JJ had made at the start of the porject and also uead the font that we where using for the game in the development stage.
 
 
Above is a close up of the planet the JJ made the texture in Photoshop we did not what to use the Hi defanition texture as we where conserned that the game would crach.
 
 
Above is the final screen that will be in the game the plant dose spin on and 360 degree rotation.

Monday, 22 April 2013

Possible sound code ?

Hey I know we haven't talked about this butu i thought a possible effect could be once you pick up a plant the beacon component will appear with an invisible collider and using this code:

function OnTriggerEnter(otherObj: Collider){
    if (otherObj.tag == "Player"){
        audio.Play();
    }
}

function OnTriggerExit(otherObj: Collider){
    if (otherObj.tag == "Player"){
        audio.Stop();
    }
}


we could have a sketchy noise pollution type track play whenever you enter the invisble collider I'm trying to work out if i can make it fade in and out kind of thing so i will update if i do. Found this whilst looking for effects stuff