I am making a Ninja duck run game similar Ninja Chicken on steam. but i have been having a little trouble geting all the aims correct.
If by character controller you mean the capsule which comes with the First Person Controller, that would be the “Graphics” child of the First Person Controller prefab. Simply turn on the Mesh Renderer of the “Graphics” game object and it will display in game mode. However, if you use the First Person Controller just like it is provided with your unity install without modifying it, you won’t see it in the first person perspective unless you look into a mirror surface. The camera is attached to the top so that the capsule is not visible by rotating the camera.
/*
Script Name : resume_screen
…*/
var sw : float;
var sh : float;
var my_GuiStyle :GUIStyle;
var myFont : Font;
var target_texture : Texture2D;
var resume_btn : Texture2D;
var Exit_btn : Texture2D;
var next_btn_texture : Texture2D;
var quite_btn_texture : Texture2D;
var retry_btn_texture : Texture2D;
var levelsln_btn_texture : Texture2D;
var run_tx : Texture2D;
var coin_tx : Texture2D;
var daimond_tx : Texture2D;
var pearl_tx : Texture2D;
var customGuiStyle : GUIStyle;
var scores : GUIStyle;
var coustam_gui : GUIStyle;
var level_selected : int;
var level_complete : int;
var go : boolean;
var level_finish : boolean;
var isGameWin : boolean;
var islose : boolean;
var Up: GameObject;
var Down : GameObject;
private var sound_mang : GameObject;
private var obj_packed_sprite: PackedSprite;
private var obj_CharacterController1 : CharacterController1;
private var obj_objects_destroy : Objects_Destroy;
private var obj_LevelSelection:LevelSelection;
private var obj_soundmanager : Sound_Manager;
var timer : float;
function Start()
{
if(sw<=800)
{
// Font_boolean = true;
my_GuiStyle.font = myFont;
}
isGameWin = true;
islose = true;
sw = Screen.width;
sh = Screen.height;
level_selected = PlayerPrefs.GetInt(“Level_selected”);
obj_CharacterController1 = GameObject.Find(“Duck”).GetComponent(“CharacterController1”);
obj_objects_destroy = GameObject.Find(“Duck”).GetComponent(“Objects_Destroy”);
level_complete = 0;
Time.timeScale = 1;
obj_packed_sprite = GameObject.Find(“Duck”).GetComponent(“PackedSprite”);
level_finish = false;
obj_soundmanager = GameObject.Find(“SoundManager”).GetComponent(“Sound_Manager”);
sound_mang = GameObject.FindGameObjectWithTag(“Sound_Manager”);
if(sound_mang)
{
Destroy (sound_mang);
}
timer = 0;
}
function Update()
{
if(level_finish == true)
{
Up.gameObject.active = false;
Down.gameObject.active = false;
}
if(level_selected == 1)
{
if(obj_CharacterController1.run >= 50 && obj_CharacterController1.coins_collectd >= 100)
{
timer += Time.deltaTime;
if(timer>.5)
{
Time.timeScale = 0;
PlayerPrefs.SetInt("no_of_level_unlocked",2);
level_complete = 1;
}
}
}
if(level_selected == 2)
{
if(obj_CharacterController1.run >= 50 && obj_CharacterController1.coins_collectd >= 75 && obj_CharacterController1.daimond_collected >= 15 )
{
timer += Time.deltaTime;
if(timer>.5)
{
Time.timeScale = 0;
PlayerPrefs.SetInt("no_of_level_unlocked",3);
level_complete = 2;
}
}
}
if(level_selected == 3)
{
if(obj_CharacterController1.run >= 75 && obj_CharacterController1.coins_collectd >= 100 && obj_CharacterController1.daimond_collected >= 20 && obj_CharacterController1.pearl_collected >= 20)
{
timer += Time.deltaTime;
if(timer>.5)
{
Time.timeScale = 0;
PlayerPrefs.SetInt("no_of_level_unlocked",4);
level_complete = 3;
}
}
}
if(level_selected == 4)
{
if(obj_CharacterController1.run >= 100 && obj_CharacterController1.coins_collectd >= 125 && obj_CharacterController1.daimond_collected >= 25 && obj_CharacterController1.pearl_collected >= 25)
{
timer += Time.deltaTime;
if(timer>.5)
{
Time.timeScale = 0;
PlayerPrefs.SetInt("no_of_level_unlocked",5);
level_complete = 4;
}
}
}
if(level_selected == 5)
{
if(obj_CharacterController1.run >=125 && obj_CharacterController1.coins_collectd >= 150 && obj_CharacterController1.daimond_collected >= 30 && obj_CharacterController1.pearl_collected >= 30)
{
timer += Time.deltaTime;
if(timer>.5)
{
Time.timeScale = 0;
level_complete = 5;
}
}
}
}
function OnGUI ()
{
if(level_selected ==1 && (Input.GetKeyDown(KeyCode.Escape)))
{
Application.LoadLevel("1_Level_Selection");
}
if(level_selected ==2 && (Input.GetKeyDown(KeyCode.Escape)))
{
Application.LoadLevel("1_Level_Selection");
}
if(level_selected ==3 && (Input.GetKeyDown(KeyCode.Escape)))
{
Application.LoadLevel("1_Level_Selection");
}
if(level_selected ==4 && (Input.GetKeyDown(KeyCode.Escape)))
{
Application.LoadLevel("1_Level_Selection");
}
if(level_selected ==5 && (Input.GetKeyDown(KeyCode.Escape)))
{
Application.LoadLevel("1_Level_Selection");
}
if(sw <=800)
{
if(level_selected == 1)
{
if(level_finish == false && obj_objects_destroy.duck_destroyed ==false )
{
GUI.DrawTexture(Rect(sw/3.7,sh/34,sw/24,sw/18),run_tx);
GUI.DrawTexture(Rect(sw/2.4,sh/30,sw/18,sw/18),coin_tx);
GUI.Box(Rect(sw/70,sh/20,sw/3.5,sh/12),"Score:" + obj_CharacterController1.Score,my_GuiStyle);
GUI.Box(Rect(sw/3.5,sh/20,sw/7,sh/12)," " + obj_CharacterController1.run,my_GuiStyle);
GUI.Box(Rect(sw/2.2,sh/20,sw/5,sh/12)," " + obj_CharacterController1.coins_collectd,my_GuiStyle);
}
}
if(level_selected == 2)
{
if(level_finish == false && obj_objects_destroy.duck_destroyed ==false)
{
GUI.DrawTexture(Rect(sw/3.7,sh/34,sw/24,sw/18),run_tx);
GUI.DrawTexture(Rect(sw/2.4,sh/30,sw/18,sw/18),coin_tx);
GUI.DrawTexture(Rect(sw/1.65,sh/30,sw/18,sw/18),daimond_tx);
GUI.Box(Rect(sw/70,sh/20,sw/3.5,sh/12),"Score:" + obj_CharacterController1.Score,my_GuiStyle);
GUI.Box(Rect(sw/3.5,sh/20,sw/7,sh/12)," " + obj_CharacterController1.run,my_GuiStyle);
GUI.Box(Rect(sw/2.2,sh/20,sw/8,sh/12)," " + obj_CharacterController1.coins_collectd,my_GuiStyle);
GUI.Box(Rect(sw/1.55,sh/20,sw/5,sh/12)," " + obj_CharacterController1.daimond_collected,my_GuiStyle);
}
}
if(level_selected == 3)
{
if(level_finish == false && obj_objects_destroy.duck_destroyed ==false)
{
GUI.DrawTexture(Rect(sw/3.7,sh/34,sw/24,sw/18),run_tx);
GUI.DrawTexture(Rect(sw/2.4,sh/30,sw/18,sw/18),coin_tx);
GUI.DrawTexture(Rect(sw/1.65,sh/30,sw/18,sw/18),daimond_tx);
GUI.DrawTexture(Rect(sw/1.33,sh/30,sw/18,sw/18),pearl_tx);
GUI.Box(Rect(sw/70,sh/20,sw/3.5,sh/12),"Score:" + obj_CharacterController1.Score,my_GuiStyle);
GUI.Box(Rect(sw/3.5,sh/20,sw/7,sh/12)," " + obj_CharacterController1.run,my_GuiStyle);
GUI.Box(Rect(sw/2.2,sh/20,sw/8,sh/12)," " + obj_CharacterController1.coins_collectd,my_GuiStyle);
GUI.Box(Rect(sw/1.55,sh/20,sw/8,sh/12)," " + obj_CharacterController1.daimond_collected,my_GuiStyle);
GUI.Box(Rect(sw/1.28,sh/20,sw/8,sh/12)," " + obj_CharacterController1.pearl_collected,my_GuiStyle);
}
}
if(level_selected == 4)
{
if(level_finish == false && obj_objects_destroy.duck_destroyed ==false)
{
GUI.DrawTexture(Rect(sw/3.7,sh/34,sw/24,sw/18),run_tx);
GUI.DrawTexture(Rect(sw/2.4,sh/30,sw/18,sw/18),coin_tx);
GUI.DrawTexture(Rect(sw/1.65,sh/30,sw/18,sw/18),daimond_tx);
GUI.DrawTexture(Rect(sw/1.33,sh/30,sw/18,sw/18),pearl_tx);
GUI.Box(Rect(sw/70,sh/20,sw/3.5,sh/12),"Score:" + obj_CharacterController1.Score,my_GuiStyle);
GUI.Box(Rect(sw/3.5,sh/20,sw/7,sh/12)," " + obj_CharacterController1.run,my_GuiStyle);
GUI.Box(Rect(sw/2.2,sh/20,sw/8,sh/12)," " + obj_CharacterController1.coins_collectd,my_GuiStyle);
GUI.Box(Rect(sw/1.55,sh/20,sw/8,sh/12)," " + obj_CharacterController1.daimond_collected,my_GuiStyle);
GUI.Box(Rect(sw/1.28,sh/20,sw/8,sh/12)," " + obj_CharacterController1.pearl_collected,my_GuiStyle);
}
}
if(level_selected == 5)
{
if(level_finish == false && obj_objects_destroy.duck_destroyed ==false)
{
GUI.DrawTexture(Rect(sw/3.7,sh/34,sw/24,sw/18),run_tx);
GUI.DrawTexture(Rect(sw/2.4,sh/30,sw/18,sw/18),coin_tx);
GUI.DrawTexture(Rect(sw/1.65,sh/30,sw/18,sw/18),daimond_tx);
GUI.DrawTexture(Rect(sw/1.33,sh/30,sw/18,sw/18),pearl_tx);
GUI.Box(Rect(sw/70,sh/20,sw/3.5,sh/12),"Score:" + obj_CharacterController1.Score,my_GuiStyle);
GUI.Box(Rect(sw/3.5,sh/20,sw/7,sh/12)," " + obj_CharacterController1.run,my_GuiStyle);
GUI.Box(Rect(sw/2.2,sh/20,sw/8,sh/12)," " + obj_CharacterController1.coins_collectd,my_GuiStyle);
GUI.Box(Rect(sw/1.55,sh/20,sw/8,sh/12)," " + obj_CharacterController1.daimond_collected,my_GuiStyle);
GUI.Box(Rect(sw/1.28,sh/20,sw/8,sh/12)," " + obj_CharacterController1.pearl_collected,my_GuiStyle);
}
}
}
else
{
if(level_selected == 1)
{
if(level_finish == false && obj_objects_destroy.duck_destroyed ==false )
{
GUI.DrawTexture(Rect(sw/3.7,sh/34,sw/24,sw/18),run_tx);
GUI.DrawTexture(Rect(sw/2.4,sh/30,sw/18,sw/18),coin_tx);
GUI.Box(Rect(sw/70,sh/20,sw/3.5,sh/12),“Score:” + obj_CharacterController1.Score,my_GuiStyle);
GUI.Box(Rect(sw/3.5,sh/20,sw/7,sh/12)," " + obj_CharacterController1.run,my_GuiStyle);
GUI.Box(Rect(sw/2.2,sh/20,sw/5,sh/12)," " + obj_CharacterController1.coins_collectd,my_GuiStyle);
}
}
if(level_selected == 2)
{
if(level_finish == false && obj_objects_destroy.duck_destroyed ==false)
{
GUI.DrawTexture(Rect(sw/3.7,sh/34,sw/24,sw/18),run_tx);
GUI.DrawTexture(Rect(sw/2.4,sh/30,sw/18,sw/18),coin_tx);
GUI.DrawTexture(Rect(sw/1.65,sh/30,sw/18,sw/18),daimond_tx);
GUI.Box(Rect(sw/70,sh/20,sw/3.5,sh/12),"Score:" + obj_CharacterController1.Score,coustam_gui);
GUI.Box(Rect(sw/3.5,sh/20,sw/7,sh/12)," " + obj_CharacterController1.run,coustam_gui);
GUI.Box(Rect(sw/2.2,sh/20,sw/8,sh/12)," " + obj_CharacterController1.coins_collectd,coustam_gui);
GUI.Box(Rect(sw/1.55,sh/20,sw/5,sh/12)," " + obj_CharacterController1.daimond_collected,coustam_gui);
}
}
if(level_selected == 3)
{
if(level_finish == false && obj_objects_destroy.duck_destroyed ==false)
{
GUI.DrawTexture(Rect(sw/3.7,sh/34,sw/24,sw/18),run_tx);
GUI.DrawTexture(Rect(sw/2.4,sh/30,sw/18,sw/18),coin_tx);
GUI.DrawTexture(Rect(sw/1.65,sh/30,sw/18,sw/18),daimond_tx);
GUI.DrawTexture(Rect(sw/1.33,sh/30,sw/18,sw/18),pearl_tx);
GUI.Box(Rect(sw/70,sh/20,sw/3.5,sh/12),"Score:" + obj_CharacterController1.Score,my_GuiStyle);
GUI.Box(Rect(sw/3.5,sh/20,sw/7,sh/12)," " + obj_CharacterController1.run,my_GuiStyle);
GUI.Box(Rect(sw/2.2,sh/20,sw/8,sh/12)," " + obj_CharacterController1.coins_collectd,my_GuiStyle);
GUI.Box(Rect(sw/1.55,sh/20,sw/8,sh/12)," " + obj_CharacterController1.daimond_collected,my_GuiStyle);
GUI.Box(Rect(sw/1.24,sh/20,sw/8,sh/12)," " + obj_CharacterController1.pearl_collected,my_GuiStyle);
}
}
if(level_selected == 4)
{
if(level_finish == false && obj_objects_destroy.duck_destroyed ==false)
{
GUI.DrawTexture(Rect(sw/3.7,sh/34,sw/24,sw/18),run_tx);
GUI.DrawTexture(Rect(sw/2.4,sh/30,sw/18,sw/18),coin_tx);
GUI.DrawTexture(Rect(sw/1.65,sh/30,sw/18,sw/18),daimond_tx);
GUI.DrawTexture(Rect(sw/1.33,sh/30,sw/18,sw/18),pearl_tx);
GUI.Box(Rect(sw/70,sh/20,sw/3.5,sh/12),"Score:" + obj_CharacterController1.Score,my_GuiStyle);
GUI.Box(Rect(sw/3.5,sh/20,sw/7,sh/12)," " + obj_CharacterController1.run,my_GuiStyle);
GUI.Box(Rect(sw/2.2,sh/20,sw/8,sh/12)," " + obj_CharacterController1.coins_collectd,my_GuiStyle);
GUI.Box(Rect(sw/1.55,sh/20,sw/8,sh/12)," " + obj_CharacterController1.daimond_collected,my_GuiStyle);
GUI.Box(Rect(sw/1.24,sh/20,sw/8,sh/12)," " + obj_CharacterController1.pearl_collected,my_GuiStyle);
}
}
if(level_selected == 5)
{
if(level_finish == false && obj_objects_destroy.duck_destroyed ==false)
{
GUI.DrawTexture(Rect(sw/3.7,sh/34,sw/24,sw/18),run_tx);
GUI.DrawTexture(Rect(sw/2.4,sh/30,sw/18,sw/18),coin_tx);
GUI.DrawTexture(Rect(sw/1.65,sh/30,sw/18,sw/18),daimond_tx);
GUI.DrawTexture(Rect(sw/1.33,sh/30,sw/18,sw/18),pearl_tx);
GUI.Box(Rect(sw/70,sh/20,sw/3.5,sh/12),"Score:" + obj_CharacterController1.Score,my_GuiStyle);
GUI.Box(Rect(sw/3.5,sh/20,sw/7,sh/12)," " + obj_CharacterController1.run,my_GuiStyle);
GUI.Box(Rect(sw/2.2,sh/20,sw/8,sh/12)," " + obj_CharacterController1.coins_collectd,my_GuiStyle);
GUI.Box(Rect(sw/1.55,sh/20,sw/8,sh/12)," " + obj_CharacterController1.daimond_collected,my_GuiStyle);
GUI.Box(Rect(sw/1.24,sh/20,sw/8,sh/12)," " + obj_CharacterController1.pearl_collected,my_GuiStyle);
}
}
}
if(sw <=480)
{
if(level_complete == 1)
{
obj_soundmanager.Stop_respectiveSound(0);
if(isGameWin)
{
obj_soundmanager.Play_RespectiveSound(1);
isGameWin = false;
}
level_finish = true;
obj_packed_sprite.PauseAnim();
GUI.DrawTexture(Rect(sw/5.5,sh/6.8,sw/1.5,sh/1.3),target_texture);
GUI.Label(Rect(sw/4.3,sh/5,sw/2,sh/1.5)," Level-1 Completed",customGuiStyle);
GUI.DrawTexture(Rect(sw/2.4,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.7,sh/3.1,sw/12,sh/10),“” + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/2.2,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.7,sh/2.1,sw/12,sh/10),“” + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/1.40,sh/1.3,sw/6,sh/6),next_btn_texture);
if(GUI.Button(Rect(sw/1.40,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
PlayerPrefs.SetInt("Level_selected",PlayerPrefs.GetInt("Level_selected")+1);
Application.LoadLevel("2_target_screen");
}
GUI.DrawTexture(Rect(sw/7,sh/1.3,sw/6,sh/6),levelsln_btn_texture);
if(GUI.Button(Rect(sw/7,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/2.3,sh/1.3,sw/6,sh/6),retry_btn_texture);
if(GUI.Button(Rect(sw/2.3,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
level_finish = false;
Time.timeScale = 1;
}
}
if(level_complete == 2)
{
obj_soundmanager.Stop_respectiveSound(0);
if(isGameWin)
{
obj_soundmanager.Play_RespectiveSound(1);
isGameWin = false;
}
level_finish = true;
obj_packed_sprite.PauseAnim();
GUI.DrawTexture(Rect(sw/5.5,sh/6.8,sw/1.5,sh/1.3),target_texture);
GUI.Label(Rect(sw/4,sh/5,sw/2,sh/1.5)," Level-2 Completed",customGuiStyle);
GUI.DrawTexture(Rect(sw/2.4,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/2.2,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.1,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.5,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.5,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/1.40,sh/1.3,sw/6,sh/6),next_btn_texture);
if(GUI.Button(Rect(sw/1.40,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
PlayerPrefs.SetInt("Level_selected",PlayerPrefs.GetInt("Level_selected")+1);
Application.LoadLevel("2_target_screen");
}
GUI.DrawTexture(Rect(sw/7,sh/1.3,sw/6,sh/6),levelsln_btn_texture);
if(GUI.Button(Rect(sw/7,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/2.30,sh/1.3,sw/6,sh/6),retry_btn_texture);
if(GUI.Button(Rect(sw/2.30,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
level_finish = false;
Time.timeScale = 1;
}
}
if(level_complete == 3)
{
obj_soundmanager.Stop_respectiveSound(0);
if(isGameWin)
{
obj_soundmanager.Play_RespectiveSound(1);
isGameWin = false;
}
level_finish = true;
obj_packed_sprite.PauseAnim();
GUI.DrawTexture(Rect(sw/5.5,sh/6.8,sw/1.5,sh/1.3),target_texture);
GUI.Label(Rect(sw/4,sh/5,sw/2,sh/1.5)," Level-3 Completed",customGuiStyle);
GUI.DrawTexture(Rect(sw/2.4,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/2.35,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.25,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.5,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.5,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.84,sw/22,sh/14),pearl_tx);
GUI.Label(Rect(sw/1.8,sh/1.8,sw/12,sh/10),"" + obj_CharacterController1.pearl_collected,scores);
GUI.DrawTexture(Rect(sw/1.40,sh/1.3,sw/6,sh/6),next_btn_texture);
if(GUI.Button(Rect(sw/1.40,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
PlayerPrefs.SetInt("Level_selected",PlayerPrefs.GetInt("Level_selected")+1);
Application.LoadLevel("2_target_screen");
}
GUI.DrawTexture(Rect(sw/7,sh/1.3,sw/6,sh/6),levelsln_btn_texture);
if(GUI.Button(Rect(sw/7,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/2.30,sh/1.3,sw/6,sh/6),retry_btn_texture);
if(GUI.Button(Rect(sw/2.30,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
level_finish = false;
Time.timeScale = 1;
}
}
if(level_complete == 4)
{
obj_soundmanager.Stop_respectiveSound(0);
if(isGameWin)
{
obj_soundmanager.Play_RespectiveSound(1);
isGameWin = false;
}
level_finish = true;
obj_packed_sprite.PauseAnim();
GUI.DrawTexture(Rect(sw/5.5,sh/6.8,sw/1.5,sh/1.3),target_texture);
GUI.Label(Rect(sw/4,sh/5,sw/2,sh/1.5)," Level-4 Completed",customGuiStyle);
GUI.DrawTexture(Rect(sw/2.4,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/2.35,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.25,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.5,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.5,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.84,sw/22,sh/14),pearl_tx);
GUI.Label(Rect(sw/1.8,sh/1.8,sw/12,sh/10),"" + obj_CharacterController1.pearl_collected,scores);
GUI.DrawTexture(Rect(sw/1.40,sh/1.3,sw/6,sh/6),next_btn_texture);
if(GUI.Button(Rect(sw/1.40,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
PlayerPrefs.SetInt("Level_selected",PlayerPrefs.GetInt("Level_selected")+1);
Application.LoadLevel("2_target_screen");
}
GUI.DrawTexture(Rect(sw/7,sh/1.3,sw/6,sh/6),levelsln_btn_texture);
if(GUI.Button(Rect(sw/7,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/2.30,sh/1.3,sw/6,sh/6),retry_btn_texture);
if(GUI.Button(Rect(sw/2.30,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
level_finish = false;
Time.timeScale = 1;
}
}
if(level_complete == 5)
{
obj_soundmanager.Stop_respectiveSound(0);
if(isGameWin)
{
obj_soundmanager.Play_RespectiveSound(1);
isGameWin = false;
}
level_finish = true;
obj_packed_sprite.PauseAnim();
var myStyle: GUIStyle = new GUIStyle();
myStyle.font = myFont;
GUI.Label(new Rect(sw/3,sh/16,sw/1.5,sh/1.3), "Congratulations .....!", myStyle);
GUI.DrawTexture(Rect(sw/5.5,sh/6.8,sw/1.5,sh/1.3),target_texture);
GUI.Label(Rect(sw/4,sh/5,sw/2,sh/1.5)," Level-5 Completed",customGuiStyle);
GUI.DrawTexture(Rect(sw/2.4,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/2.35,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.25,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.5,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.5,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.84,sw/22,sh/14),pearl_tx);
GUI.Label(Rect(sw/1.8,sh/1.8,sw/12,sh/10),"" + obj_CharacterController1.pearl_collected,scores);
GUI.DrawTexture(Rect(sw/1.40,sh/1.3,sw/6,sh/6),quite_btn_texture);
if(GUI.Button(Rect(sw/1.40,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("0_MenuScreen");
}
GUI.DrawTexture(Rect(sw/7,sh/1.3,sw/6,sh/6),levelsln_btn_texture);
if(GUI.Button(Rect(sw/7,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/2.30,sh/1.3,sw/6,sh/6),retry_btn_texture);
if(GUI.Button(Rect(sw/2.30,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
level_finish = false;
Time.timeScale = 1;
}
}
}
else
{
if(level_complete == 1)
{
obj_soundmanager.Stop_respectiveSound(0);
if(isGameWin)
{
obj_soundmanager.Play_RespectiveSound(1);
isGameWin = false;
}
level_finish = true;
obj_packed_sprite.PauseAnim();
GUI.DrawTexture(Rect(sw/5.5,sh/6.8,sw/1.5,sh/1.3),target_texture);
GUI.Label(Rect(sw/2.8,sh/5,sw/2,sh/1.5)," Level-1 Completed",customGuiStyle);
GUI.DrawTexture(Rect(sw/2.4,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.7,sh/3.1,sw/12,sh/10),“” + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/2.2,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.7,sh/2.1,sw/12,sh/10),“” + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/1.40,sh/1.3,sw/6,sh/6),next_btn_texture);
if(GUI.Button(Rect(sw/1.40,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
PlayerPrefs.SetInt("Level_selected",PlayerPrefs.GetInt("Level_selected")+1);
Application.LoadLevel("2_target_screen");
}
GUI.DrawTexture(Rect(sw/7,sh/1.3,sw/6,sh/6),levelsln_btn_texture);
if(GUI.Button(Rect(sw/7,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/2.3,sh/1.3,sw/6,sh/6),retry_btn_texture);
if(GUI.Button(Rect(sw/2.3,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
level_finish = false;
Time.timeScale = 1;
}
}
if(level_complete == 2)
{
obj_soundmanager.Stop_respectiveSound(0);
if(isGameWin)
{
obj_soundmanager.Play_RespectiveSound(1);
isGameWin = false;
}
level_finish = true;
obj_packed_sprite.PauseAnim();
GUI.DrawTexture(Rect(sw/5.5,sh/6.8,sw/1.5,sh/1.3),target_texture);
GUI.Label(Rect(sw/2.8,sh/5,sw/2,sh/1.5)," Level-2 Completed",customGuiStyle);
GUI.DrawTexture(Rect(sw/2.4,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/2.2,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.1,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.5,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.5,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/1.40,sh/1.3,sw/6,sh/6),next_btn_texture);
if(GUI.Button(Rect(sw/1.40,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
PlayerPrefs.SetInt("Level_selected",PlayerPrefs.GetInt("Level_selected")+1);
Application.LoadLevel("2_target_screen");
}
GUI.DrawTexture(Rect(sw/7,sh/1.3,sw/6,sh/6),levelsln_btn_texture);
if(GUI.Button(Rect(sw/7,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/2.30,sh/1.3,sw/6,sh/6),retry_btn_texture);
if(GUI.Button(Rect(sw/2.30,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
level_finish = false;
Time.timeScale = 1;
}
}
if(level_complete == 3)
{
obj_soundmanager.Stop_respectiveSound(0);
if(isGameWin)
{
obj_soundmanager.Play_RespectiveSound(1);
isGameWin = false;
}
level_finish = true;
obj_packed_sprite.PauseAnim();
GUI.DrawTexture(Rect(sw/5.5,sh/6.8,sw/1.5,sh/1.3),target_texture);
GUI.Label(Rect(sw/2.8,sh/5,sw/2,sh/1.5)," Level-3 Completed",customGuiStyle);
GUI.DrawTexture(Rect(sw/2.4,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/2.35,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.25,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.5,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.5,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.84,sw/22,sh/14),pearl_tx);
GUI.Label(Rect(sw/1.8,sh/1.8,sw/12,sh/10),"" + obj_CharacterController1.pearl_collected,scores);
GUI.DrawTexture(Rect(sw/1.40,sh/1.3,sw/6,sh/6),next_btn_texture);
if(GUI.Button(Rect(sw/1.40,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
PlayerPrefs.SetInt("Level_selected",PlayerPrefs.GetInt("Level_selected")+1);
Application.LoadLevel("2_target_screen");
}
GUI.DrawTexture(Rect(sw/7,sh/1.3,sw/6,sh/6),levelsln_btn_texture);
if(GUI.Button(Rect(sw/7,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/2.30,sh/1.3,sw/6,sh/6),retry_btn_texture);
if(GUI.Button(Rect(sw/2.30,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
level_finish = false;
Time.timeScale = 1;
}
}
if(level_complete == 4)
{
obj_soundmanager.Stop_respectiveSound(0);
if(isGameWin)
{
obj_soundmanager.Play_RespectiveSound(1);
isGameWin = false;
}
level_finish = true;
obj_packed_sprite.PauseAnim();
GUI.DrawTexture(Rect(sw/5.5,sh/6.8,sw/1.5,sh/1.3),target_texture);
GUI.Label(Rect(sw/2.8,sh/5,sw/2,sh/1.5)," Level-4 Completed",customGuiStyle);
GUI.DrawTexture(Rect(sw/2.4,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/2.35,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.25,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.5,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.5,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.84,sw/22,sh/14),pearl_tx);
GUI.Label(Rect(sw/1.8,sh/1.8,sw/12,sh/10),"" + obj_CharacterController1.pearl_collected,scores);
GUI.DrawTexture(Rect(sw/1.40,sh/1.3,sw/6,sh/6),next_btn_texture);
if(GUI.Button(Rect(sw/1.40,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
PlayerPrefs.SetInt("Level_selected",PlayerPrefs.GetInt("Level_selected")+1);
Application.LoadLevel("2_target_screen");
}
GUI.DrawTexture(Rect(sw/7,sh/1.3,sw/6,sh/6),levelsln_btn_texture);
if(GUI.Button(Rect(sw/7,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/2.30,sh/1.3,sw/6,sh/6),retry_btn_texture);
if(GUI.Button(Rect(sw/2.30,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
level_finish = false;
Time.timeScale = 1;
}
}
if(level_complete == 5)
{
obj_soundmanager.Stop_respectiveSound(0);
if(isGameWin)
{
obj_soundmanager.Play_RespectiveSound(1);
isGameWin = false;
}
level_finish = true;
obj_packed_sprite.PauseAnim();
var myStyle2: GUIStyle = new GUIStyle();
myStyle2.font = myFont;
GUI.Label(new Rect(sw/3,sh/16,sw/1.5,sh/1.3), "Congratulations .....!", myStyle2);
GUI.DrawTexture(Rect(sw/5.5,sh/6.8,sw/1.5,sh/1.3),target_texture);
GUI.Label(Rect(sw/2.8,sh/5,sw/2,sh/1.5)," Level-5 Completed",customGuiStyle);
GUI.DrawTexture(Rect(sw/2.4,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/2.35,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.25,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.5,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.5,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/2.4,sh/1.84,sw/22,sh/14),pearl_tx);
GUI.Label(Rect(sw/1.8,sh/1.8,sw/12,sh/10),"" + obj_CharacterController1.pearl_collected,scores);
GUI.DrawTexture(Rect(sw/1.40,sh/1.3,sw/6,sh/6),quite_btn_texture);
if(GUI.Button(Rect(sw/1.40,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("0_MenuScreen");
}
GUI.DrawTexture(Rect(sw/7,sh/1.3,sw/6,sh/6),levelsln_btn_texture);
if(GUI.Button(Rect(sw/7,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/2.30,sh/1.3,sw/6,sh/6),retry_btn_texture);
if(GUI.Button(Rect(sw/2.30,sh/1.3,sw/6,sh/6),"",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
level_finish = false;
Time.timeScale = 1;
}
}
}
if(obj_objects_destroy.duck_destroyed)
{
obj_soundmanager.Stop_respectiveSound(0);
if(islose)
{
obj_soundmanager.Play_RespectiveSound(2);
islose = false;
}
// Up.gameObject.active = false;
// Down.gameObject.active = false;
Destroy(GameObject.FindGameObjectWithTag("up"));
Destroy(GameObject.FindGameObjectWithTag("down"));
if(timer>2)
{
var myStyle1: GUIStyle = new GUIStyle();
myStyle1.font = myFont;
GUI.Label(new Rect(sw/2.5,sh/16,sw/1.5,sh/1.3), "Oops .....!", myStyle1);
GUI.DrawTexture(Rect(sw/4,sh/6,sw/2,sh/1.5),target_texture);
}
if(level_selected == 1)
{
timer += Time.deltaTime;
if(timer>2)
{
GUI.DrawTexture(Rect(sw/2.5,sh/3.3,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/2.2,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.15,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
}
}
if(level_selected == 2)
{
timer += Time.deltaTime;
if(timer>2)
{
GUI.DrawTexture(Rect(sw/2.5,sh/3.5,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3.4,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/2.45,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.35,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/1.9,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.85,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
}
}
if(level_selected == 3)
{
timer += Time.deltaTime;
if(timer>2)
{
GUI.DrawTexture(Rect(sw/2.5,sh/3.75,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3.4,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/2.6,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.4,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/1.62,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.57,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/2,sw/22,sh/14),pearl_tx);
GUI.Label(Rect(sw/1.8,sh/1.88,sw/12,sh/10),"" + obj_CharacterController1.pearl_collected,scores);
}
}
if(level_selected == 4)
{
timer += Time.deltaTime;
if(timer>2)
{
GUI.DrawTexture(Rect(sw/2.5,sh/3.75,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3.4,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/2.6,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.4,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/1.62,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.57,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/2,sw/22,sh/14),pearl_tx);
GUI.Label(Rect(sw/1.8,sh/1.88,sw/12,sh/10),"" + obj_CharacterController1.pearl_collected,scores);
}
}
if(level_selected == 5)
{
timer += Time.deltaTime;
if(timer>2)
{
GUI.DrawTexture(Rect(sw/2.5,sh/3.75,sw/24,sh/10),run_tx);
GUI.Label(Rect(sw/1.8,sh/3.4,sw/12,sh/10),"" + obj_CharacterController1.run,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/2.6,sw/22,sh/14),coin_tx);
GUI.Label(Rect(sw/1.8,sh/2.4,sw/12,sh/10),"" + obj_CharacterController1.coins_collectd,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/1.62,sw/22,sh/14),daimond_tx);
GUI.Label(Rect(sw/1.8,sh/1.57,sw/12,sh/10),"" + obj_CharacterController1.daimond_collected,scores);
GUI.DrawTexture(Rect(sw/2.5,sh/2,sw/22,sh/14),pearl_tx);
GUI.Label(Rect(sw/1.8,sh/1.88,sw/12,sh/10),"" + obj_CharacterController1.pearl_collected,scores);
}
}
if(timer>2)
{
GUI.DrawTexture(Rect(sw/3.7,sh/1.40,sw/6,sh/5),levelsln_btn_texture);
if(GUI.Button(Rect(sw/3.5,sh/1.40,sw/6,sh/5)," ",GUIStyle.none))
{
Application.LoadLevel("1_Level_Selection");
}
GUI.DrawTexture(Rect(sw/1.75,sh/1.40,sw/6,sh/5),retry_btn_texture);
if(GUI.Button(Rect(sw/1.75,sh/1.40,sw/6,sh/5)," ",GUIStyle.none))
{
Application.LoadLevel("3_GamePlay");
Time.timeScale = 1;
}
}
}
}