Sunday, March 27, 2011

Sliding Platform Code

var movingbox: GameObject;
var isup = true;


function Update () {
movingbox.rigidbody.transform.Translate(Vector3.left * 2* Time.deltaTime);
if (isup ==false){
movingbox.rigidbody.transform.rotation.y += 360;
}
if (isup ==true){
movingbox.rigidbody.transform.rotation.y = 0;
}
if (movingbox.rigidbody.transform.position.x<=251.73){
isup=false;
}
if (movingbox.rigidbody.transform.position.x>=256.31){
isup=true;
}
}

Saturday, March 26, 2011

Meeting March 26, 2011

Notes:
-When enemies die, use particles instead of death animation
-Sliding platforms instead of falling platforms
-Fire Puzzle: spinning fire line(mario style), that never turns off,
-Cat Switch needs to be remodeled
-

Saturday, March 19, 2011

Week 11 - Assignment 10

var patrol:boolean = false;//
private var waiting:boolean = false;
var wait:boolean;
var waypoint:Transform[];//
var lastWayPoint:int;
var damping:float = 50;
private var targetPosition:Vector3;//
private var currentWayPoint:int = 0;//
private var startForce:float = 0.0;//
private var brakeForce:float = 2.0;//
private var accelerationForce:float =5.0;//
private var target:Transform;
private var idleHereTimer:int = 3;
private var player2 : GameObject;
private var enemyState = "String";
private var health= 100;
private var localChase =false;
private var firstX=Vector3(0.0, 0.0, 0.0);
private var lastPositionPlayer= Vector3(0.0, 0.0, 0.0);
private var returnTimer=0.0;
private var lookingTimer=0.0;
var dropItem:boolean = false;
var spawnDist:float= 0.0;
var itemDropped:GameObject;
//var distanceToGround=0.0;
var enemyLvl:int;// 0,1,2,3 determines amount of health an enemy has (0 is tutorial level)
var move:boolean = false;
var distFromTarget:Vector3;
var nxtLook:Vector3;
var forward:Vector3;
var enemyRot:Vector3;
var detectDistance : float; //Distance to the Player
private var dropped:boolean; // limits items dropped to 1

//what type of enemy is this?
var heavyMinion : boolean = false;
var mediumMinion : boolean = false;
var lightMinion : boolean = false;

var agressiveEnemy : boolean = true;
private var timer :float;// timer follows time.delta time
var attackTimer:int;// wait time between enemy attacks
private var canAttack:boolean = false;//no more being attacked
private var timeRec:int; // time to compare
//enemy damage arrays
var heavyMinionArr = new Array (8,12,20);
var mediumMinionArr = new Array (6,8,12);
var lightMinionArr = new Array (4,6,8);

//index's for generating random elements of an array
var heavyIndex : int;
var mediumIndex :int;
var lightIndex : int;

// temporary damage for enemies
private var damage:boolean;
private var hit:boolean;
function Start(){
switch(enemyLvl)
{
case 0:
health = 20;// 2 hit kill
break;
case 1:
health = 30;// 3 hit kill
break;
case 2:
health = 40;// 4 hit kill
break;
case 3:
health = 100; // boss 10 hit kill
break;
}
enemyState="idle";
player2 = GameObject.FindWithTag("Player");
//~ if(patrol == false)
//~ {
//~ enemyState = "idle";
//~ }
//~ else
//~ {
//~ enemyState = "patrol";
//~ }
firstX=transform.position;
}
function Update ()
{
// temps
if(damage)
{
health -= 10;
damage = false;
animation.Play("Med_knockback");
}
if(detectDistance < 2)
{
if(Input.GetButtonUp(Game_script.attack))
{
damage = true;
}
}
// above is temp
if(player2 == null)
{
player2 = Game_script.TheCharacter;
}
detectDistance = Vector3.Distance (player2.transform.position, transform.position);
heavyIndex = Random.Range(0,heavyMinionArr.length);
mediumIndex = Random.Range(0,heavyMinionArr.length);
lightIndex = Random.Range(0,heavyMinionArr.length);
//need to change to enemy collider ontrigger enter for hitting and animation
if (agressiveEnemy)
{
if (Game_script.playerStealthed == false)
{
if(detectDistance <= 5)
{
enemyState="chase";
}
}
if (localChase)
{
if(detectDistance >= 15)
{
startLooking();
}
}
if(move)
{
rigidbody.transform.Translate(3*Vector3.forward * Time.deltaTime);
//enemyRot = Vector3(player2.transform.position.z,transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, player2.transform.rotation, Time.deltaTime);
animation.Play("Med_walk");
}
if(enemyState=="idle"){
returnTimer=0.0;
move=false;
animation.Play("Med_idle");
}
if(enemyState == "patrol")
{
Patrolling();
}
if(enemyState == "chase"){
enemychase();
}
if(enemyState == "attackmode"){
enemyAttack();
}
if(localChase){
enemyState="chase";
}
if(enemyState=="looking"){
startLooking2();
}
if(enemyState=="confusion"){
startConfusion();
}
if(enemyState=="return"){
returnPosition();
}
if(returnTimer>=20){
enemyState="stuck";
stuck();
returnTimer=0.0;
}
if(lookingTimer>=10){
enemyState="return";
lookingTimer=0.0;
}
}
//reest position when player dies
if(Game_script.playerHealth<=0){
enemyState="return";
}
if(health <= 0) {
// may need to be health <= 0
enemyState="dead";
health=1;
Game_script.enemyDetectionLevel = 1;
Game_script.iSeeYou = false;
Player_Controls.enemyDead = true;
Death();
if(dropItem == true && dropped == false)
{
var tpos = transform.position;
var spawnPos = tpos + (Vector3(0, tpos.y - spawnDist , 0)); // can subtract 6 if we want object to hit ground
Instantiate(itemDropped, spawnPos, Quaternion.Euler(Vector3(0, 0, 270)));
dropped = true;
}
}
}
function Death(){
animation.Stop();
animation.Play("Med_death");
yield WaitForSeconds(1);
Destroy(gameObject);
}
function OnCollisionStay (collision : Collision) {
if (collision.gameObject.tag == "Player") {
enemyState="attackmode";
move=false;
}

}
function enemyAttack(){
transform.LookAt(player2.transform);
localChase=false;
move=false;

animation.Play("Med_attack1");

//localChase=true;
//enemyState="idle";
// need to change to interact with player weapon collider
//~ blocked out attack timer for now
//~ if(canAttack)
//~ {
//~ attackFunction();
//~ }
//~ else
//~ {
//~ timer += Time.deltaTime;
//~ if(timer > (timeRec + 5) - timer)
//~ {
//~ canAttack = true;
//~ }
//~ }
}
//~ blocked out attackFunction for now
//~ function attackFunction()
//~ {
//~ canAttack = false;
//~ timeRec = timer;
//~ if(heavyMinion)
//~ {
//~ Game_script.playerHealth -= heavyMinionArr[heavyIndex];
//~ switch(heavyIndex)
//~ {
//~ case 1:
//~ animation.Play("Heavy_attack1");
//~ break;
//~ case 2:
//~ animation.Play("Heavy_attack2");
//~ break;
//~ case 3:
//~ animation.Play("Heavy_attack3");
//~ break;
//~ }
//~ }
//~ else if(mediumMinion)
//~ {
//~ //Game_script.playerHealth -= mediumMinionArr[mediumIndex];
//~ switch(mediumIndex)
//~ {
//~ case 1:
//~ animation.Play("Med_attack1");
//~ break;
//~ case 2:
//~ animation.Play("Med_attack2");
//~ break;
//~ case 3:
//~ animation.Play("Med_attack3");
//~ break;
//~ }
//~ }
//~ else if(lightMinion)
//~ {
//~ Game_script.playerHealth -= lightMinionArr[lightIndex];
//~ switch(heavyIndex)
//~ {
//~ case 1:
//~ animation.Play("Heavy_attack1");
//~ break;
//~ case 2:
//~ animation.Play("Heavy_attack2");
//~ break;
//~ case 3:
//~ animation.Play("Heavy_attack3");
//~ break;
//~ }
//~ }
//~ }
function enemychase(){
transform.LookAt(player2.transform);
var dist =Vector3.Distance(player2.transform.position, transform.position);
if(dist<=2){
localChase=false;
enemyState="attackmode";
}
if (dist>=4){
move = true;
localChase =true;
}
}
function startLocalChase () {
localChase =true;
}
function startLooking(){
localChase = false;
lastPositionPlayer=player2.transform.position;
enemyState ="looking";
transform.LookAt(lastPositionPlayer);
}
function startLooking2(){
if(!localChase){
lookingTimer+= Time.deltaTime;
transform.LookAt(lastPositionPlayer);
move = true;
var dist =Vector3.Distance(lastPositionPlayer, transform.position);
if(dist<=2){
enemyState="confusion";
}
}
}
function startConfusion(){
if(!localChase){
lookingTimer=0.0;
move = false;
transform.Rotate(20*Vector3.down * Time.deltaTime);
yield WaitForSeconds(2);
enemyState="return";
}
}
function returnPosition(){
if(!localChase){
returnTimer+= Time.deltaTime;
transform.LookAt(firstX);
move = true;
var dist =Vector3.Distance(firstX, transform.position);
if(dist<=2){
enemyState="idle";
}
}
}
function stuck(){
move = false;
yield WaitForSeconds(2);
enemyState="idle";
}
function Assassination()
{
health = 0;
animation.Play("Med_assassination");
//placeholder
//yield WaitForSeconds(3);
if (!agressiveEnemy)
{
Game_script.enemyDetectionLevel = 1;
Game_script.iSeeYou = false;
Player_Controls.enemyDead = true;
}
Destroy(gameObject);
}
function Patrolling()
{
target = waypoint[currentWayPoint].transform;//
distFromTarget = target.position - transform.position;
nxtLook = target.position - transform.position;
var thisRotation = Quaternion.LookRotation(target.position - transform.position,Vector3.up);
if(move)
{
//transform.LookAt(Vector3(target.position.x, transform.position.y, target.position.z));
transform.rotation = Quaternion.Slerp(transform.rotation, thisRotation, Time.deltaTime * .3);
}
if(distFromTarget.magnitude <2.8)
{
move =false;
whatNext();
}
else
{
move = true;
}
}
function whatNext()
{
if(waiting)
{
//currentWayPoint = currentWayPoint;
//same
yield WaitForSeconds(idleHereTimer);
waiting = false;
}
else
{
NextWP();
if(wait)
{
waiting = true;
}
}
}
function NextWP()
{
switch(currentWayPoint)
{
case 0:
currentWayPoint = 1;
break;
case 1:
currentWayPoint = 2;
break;
case 2:
currentWayPoint = 3;
break;
case 3:
currentWayPoint = 4;
break;
case 4:
currentWayPoint = 5;
break;
default:
currentWayPoint = 0;
break;
}
if(currentWayPoint == lastWayPoint)
{
currentWayPoint = 0;
}
}

Week 10 - Assignment 9

Textured level 1 but we are having problems bringing it into unity, also textured and modeled the heart. I have game testing results as well. Organizing and compiling textures

Tuesday, March 8, 2011

Week 9 - Assignment 8

Textured level 1 and compiled and organized all game textures

Game Testing Log:

Started with screen res 1680 x1050 settings fantastic. Do I put my name in? what is going oo at the beginning GUI. Nice respawn.
Tutorial pop up isn’t centered
Tutorial audio doesn’t play at correct time
Player respawn player is slower
Player respawn player jump is not as high
Player too slow
Room 1 with rising pillars, pillars take too long to rise
Enemies do not attack
Enemies do not do damage
Enemies do not follow
Enemies do not die
Falling platforms fall too quickly
Falling platforms area is too empty
Torch colliders need to be removed
Stealth discoloring doesn’t match stealth
Pushing objects do not work after death
Pushing objects too slow
Jumping pushing objects difficult to climb
Hole in floor needs rubble
Footsteps sound too subtle

Week 8 - Assignment 7

Compiling and organizing all textures

Thursday, February 24, 2011

Week 7: Assignment 6

Renaming Assets and compiling and checking them all

Week 6: Assignment 5

This week we had a group texturing meeting right before class and I went over the basic shading techniques we would be using and has everyone do a sample one to present in class to see if we were headed in the right direction.

Week 5: Assignment 4

Dimmed down pot shatters
And

Compiling and organizing textures

Week 4: Assignment 3

Compiling and organizing textures

Tuesday, January 25, 2011

Week 2 HW: Animation

Sedja animation neeed a lot of work

tail attack
paw attack
neck attack
jump back
attacked animation

animations done this week

will continue to work on them

Tuesday, January 18, 2011

Week 1: Programming: Critique Notes

Sedja Animations
-Tail attack
-Attacked animation when sedja is attacked
-Jump Back Animation

Programming Notes
-Sedja needs to jump back every so often
-Sedja can't fall over, either increase the mass or create some kind of platform collider
-Sedja needs a collider on head
-Sedja needs to be bigger
-Horus needs to get knocked back when he is hit

Week 1: Programming: Level Sedja



Added new player controller. Sedja needs to push Horus back.

Week 1: Animation: Pot Breakage

Shattered some pots

Tuesday, December 14, 2010

Week 11: Programming


Beginning Sedja AI Script:

var horous: GameObject;
var enemyState = "String";
var health=100;
var attackState="String";

function Start(){
enemyState="chasemode";
attackState="weak";
}
function Update () {


var dist =Vector3.Distance(horous.transform.position, transform.position);
if(dist>=5){
enemyState="chasemode";

}
if(enemyState=="chasemode"){
enemychase();
}
if(enemyState=="attackmode"){
attackmode();
}
if(health<=0){
Destroy(gameObject);
}

}
function enemychase(){
transform.LookAt(horous.transform);
var dist =Vector3.Distance(horous.transform.position, transform.position);

if(dist<=2.3){
enemyState="attackmode";
animation.Play ("runoutro");

}
else{
rigidbody.transform.Translate(5*Vector3.forward * Time.deltaTime);
animation.Play ("run");
}
}
function attackmode(){
if(health<=0){
animation.Play ("attack2");
}
else{
animation.Play ("attack");
}
}


function OnGUI () {

GUI.Label(Rect(Screen.width - 120, 10, 200, 50),"Enemy Health: " + health);

}
function OnTriggerExit(other : Collider){
if (other.gameObject.tag == "player_weapon") {
health-=10;
}
}



Week 11: Animation


Sedja Run Animation

Week 10: Programming

Think and braingstorming this week for boss battle coding

Week 6: Programming

var health= 100;

function OnGUI () {

GUI.Label(Rect(Screen.width - 100, 10, 200, 50),"Enemy Health: " + health);

}

Monday, December 6, 2010

Week 9: Programming: Enemy AI

var enemyaggro : GameObject;
var player2 : GameObject;
var enemyState = "String";
var health= 100;
var localChase =false;
var firstX=Vector3(0.0, 0.0, 0.0);
var lastPositionPlayer= Vector3(0.0, 0.0, 0.0);
var returnTimer=0.0;
var lookingTimer=0.0;
var enemyPrefab : GameObject;



function Start(){
enemyState = "idle";
print(enemyState);
firstX=transform.position;
}
function Update () {

if(enemyState=="idle"){
returnTimer=0.0;
}
if(enemyState == "chase"){
enemychase();
print(enemyState);
}
if(enemyState == "attackmode"){
enemyAttack();
print(enemyState);
}
if(localChase){
enemyState="chase";
}
if(enemyState=="looking"){
startLooking2();
}
if(enemyState=="confusion"){
startConfusion();
}
if(enemyState=="return"){
returnPosition();
}
if(returnTimer>=5){
enemyState="stuck";
stuck();
returnTimer=0.0;
}
if(lookingTimer>=20){
enemyState="return";
lookingTimer=0.0;
}
}

function OnCollisionStay (collision : Collision) {
if (collision.gameObject.tag == "Player") {
enemyState="attackmode";
}

}
function enemyAttack(){


transform.LookAt(player2.transform);
localChase=false;
yield;
print("enemyhit");
yield;
localChase=true;
enemyState="idle";


}
function enemychase(){
transform.LookAt(player2.transform);
var dist =Vector3.Distance(player2.transform.position, transform.position);
if(dist<=2){
localChase=false;
enemyState="attackmode";
}
else{
rigidbody.transform.Translate(2*Vector3.forward * Time.deltaTime);
}
}
function startLocalChase () {
localChase =true;
}
function startLooking(){
localChase = false;
lastPositionPlayer=player2.transform.position;
enemyState ="looking";
transform.LookAt(lastPositionPlayer);
}
function startLooking2(){
if(!localChase){
lookingTimer+= Time.deltaTime;
transform.LookAt(lastPositionPlayer);
rigidbody.transform.Translate(2*Vector3.forward * Time.deltaTime);
var dist =Vector3.Distance(lastPositionPlayer, transform.position);
if(dist<=2){
enemyState="confusion";
print(enemyState);
}
}
}
function startConfusion(){
if(!localChase){
lookingTimer=0.0;
transform.Rotate(20*Vector3.down * Time.deltaTime);
yield WaitForSeconds(2);
enemyState="return";
print(enemyState);
}
}
function returnPosition(){
if(!localChase){
returnTimer+= Time.deltaTime;
transform.LookAt(firstX);
rigidbody.transform.Translate(2*Vector3.forward * Time.deltaTime);
var dist =Vector3.Distance(firstX, transform.position);
if(dist<=2){
enemyState="idle";
print(enemyState);
}
}
}
function stuck(){
print(enemyState);
yield WaitForSeconds(2);
enemyState="idle";
enemyarggo = Instantiate(enemyPrefab, firstX, transform.rotation);
Destroy(gameObject);


}

function OnGUI () {
GUI.Label(Rect(Screen.width - 120, 10, 200, 50),"Enemy Health: " + health);
}

Friday, November 19, 2010

Wednesday, November 10, 2010

Week 5: Programming: AI

var enemyaggro : GameObject;
var player2 : GameObject;
var enemyState = "String";
var health= 100;
var localchase =false;
var playerLastX=0.0;
var playerLastZ=0.0;
var playerLastY=0.0;
var firstX=0.0;
var switcher=1;
function Start(){
enemyState = "idle";
print(enemyState);
firstX=transform.position.x;
}
function Update () {
if(enemyState == "chase"){
enemychase();
print(enemyState);
}
if(enemyState == "attackmode"){
enemyAttack();
print(enemyState);
}
if(localchase){
enemyState="chase";
}
if(enemyState=="looking"){
startLooking2();
}
if(enemyState=="confusion"){
startConfusion();
}
}
function OnCollisionStay (collision : Collision) {
if (collision.gameObject.tag == "Player") {
enemyState="attackmode";
}
}
function enemyAttack(){
transform.LookAt(player2.transform);
print("enemyhit");
yield WaitForSeconds(3);
enemyState="idle";
}
function enemychase(){
transform.LookAt(player2.transform);
rigidbody.transform.Translate(2*Vector3.forward * Time.deltaTime);
}
function startLocalChase () {
localchase =true;
}
function startLooking(){
localchase = false;
playerLastX=player2.transform.position.x;
playerLastZ=player2.transform.position.z;
playerLastY=player2.transform.position.y;
enemyState ="looking";
transform.LookAt(Vector3(playerLastX,playerLastY,playerLastZ));
}
function startLooking2(){
if(!localchase){
rigidbody.transform.Translate(2*Vector3.forward * Time.deltaTime);
yield WaitForSeconds(6);
enemyState="confusion";
print(enemyState);
}
}
function startConfusion(){
if(!localchase){
transform.Rotate(20*Vector3.down * Time.deltaTime);
}
}
function OnGUI () {
GUI.Label(Rect(Screen.width - 120, 10, 200, 50),"Enemy Health: " + health);
}

Tuesday, October 26, 2010

Week 4: Programming

function Update() {

if(Input.GetButtonDown("KeyBoardAttack(F)"))
{

swordenable();
}
}
function swordenable(){

gameObject.tag = "player_weapon";
print("namechanged");
yield WaitForSeconds(1);
gameObject.tag = "Untagged";
}

Code which solves the previous weeks problem. Now the dagger is only active for one second after you hit the attack button.

Week 4: Texturing




Week 3: Modeling











Week 3: Programming

function OnTriggerEnter(other: Collider)
{
if(other.gameObject.tag == "player_weapon")
{
print("hit");
SendMessageUpwards ("Assasination");

}
}

This code is on a collider behind the enemy and when you sneak up behind him and attack him he will die in one hit. A problem that I am having is that the sword object is always active. So even without hitting the attack button it will kill then enemy. One way to solve this problem is im am going to change the name of the collider for the sword and only change it when the attack button is pressed and then change it back in a couple of seconds.

Tuesday, October 12, 2010

Week 2: Programming


Worked with robin getting the core mechanic started so far we have coliders on the end of the swords. We need to get the enemy prefab and not with a static variable. We will also get the enemy dying with a hit to the back and front attacks take atleast three hits.

Week 2: Level Design


Added my puzzle into level one designed by Dan. Dan and I also lightmapped the scene so it doesnt require lights in unity. Feedback: Make boxes bigger turn falling ones red.

Week 2: Texturing




Week 2: Modeling



Tuesday, August 31, 2010

Programming: Test Enviornment 03: One shadow collider


Light map created for unity


UVoutline of level 3


Overview shot in unity of the shadow collider in the scene, scene is lit with no lights

Mesh for shadow collider, this collider is ignored in unity and is used as a mesh collider. This is now used for the shadows instead of creating a ton of colliders I have one collider now.

Level 3 After Modifications
Level 3 before modifications

Tuesday, August 24, 2010

Animation: Character Walk cycle


Need to animate upper back

Animation: Character Idle


I only animated the arm I need to animate the head and bring the elbow up a little more also the entire body as well needs to be animated

Monday, August 23, 2010

Programming: Test Enviornment 03: Shader Script...


Scipt if your in a shadow


Script to enter stealth mode



GameContorller Script

Programming: Test Enviornment 03: Enemy Collider/Move Script


The enemy script (prefab) modified a bit



the enemy collider script modified a bit, includes "SendMessageUpwards" another way to avoid all enemies attacking at once



top overview of Test Enviornment 3




Angle Shot of Test Envionment #3

Saturday, August 14, 2010

Test Level Enviorment 03: Shader Script

Heres a script we can use so our char is trans/shadowing everytime hes in the shadows and when he is in the light is alpha is 100%


Heres a script where the enemies detect you in the light but not in the shadows