-----------------------------------------------------------------------------
-- Site6
-----------------------------------------------------------------------------
-- PostStage

function PostStage()
    -- do this stuff first, tells the game that the round is over
    EntGame.EnablePlayerControl(false);
    EntGame.ClearFlag(GF_READYTOSTART);
    --EntGame.BindCameraToEntity("IntroCamera"); 
    end;    
    
-----------------------------------------------------------------------------    
-- Setup

function Setup()

    -- turn on the "Game running" menu - may not be needed for this game
    EntGame.PushMenu("MenuGameRunning");

    -- load world
    SetupWorld("Maps\\Site6\\Site6.ini", "","","");
    EntGame.CreatePlayerEntities();
	
	-- Do any setup that is specifically for testing.
	if(EntGame.TestingLevels()) then
		Testing();
		end;    
    
    EntGame.SetStageTimer(100);
 
	-- cache animals
	EntGame.LoadAnimal(AID_GOOSE);
	EntGame.LoadAnimal(AID_HARLEQUINN);
	
 	-- setup tournament logic    
    EntGame.StagePrepare();           

    -- show the scene from the intro camera
    EntGame.BindCameraToEntity("IntroCamera");
    
    -- tell the game the world has loaded
    Entity.GameEventPre(Game.GetRootEntity(), GE_WORLDLOADED, 0);	

    -- wait until the intro dialog is dispatched
    while (EntGame.GetFlag(GF_READYTOSTART) == false) do
        Script.WaitFrame(1);
        end;

    -- do a fade out        
    FadeOut();
    Script.WaitSec(0.5);       
	
	end;
-----------------------------------------------------------------------------------
function Intro()
	
	EntGame.PlaySong("Music\\TheMovement.ogg");
	
	FloatingDuck = EntGame.SpawnAnimalOnPath(AID_HARLEQUINN, "DuckFloatPath01", 0, ST_PERCH, 6,0,0,1);
	Animal.FaceEntity(FloatingDuck,"DuckFloatWpt002");
	
	FloatingDuck = EntGame.SpawnAnimalOnPath(AID_HARLEQUINN, "DuckFloatPath02", 0, ST_PERCH, 6,0,0,1);
	Animal.FaceEntity(FloatingDuck,"DuckFloatWpt005");
	
	FloatingDuck = EntGame.SpawnAnimalOnPath(AID_HARLEQUINN, "DuckFloatPath03", 0, ST_PERCH, 6,0,0,1);
	Animal.FaceEntity(FloatingDuck,"DuckFloatWpt008");
    
    -- set the camera to a cool spot, then fade in
    EntGame.BindCameraToEntity("CountdownCamera3");
    FadeIn();    
    Script.WaitSec(1.0); 
    
    -- "3"
    Entity.GameEventPre(Game.GetRootEntity(), SSK1_COUNTDOWN_3, 0);   
    Script.WaitSec(1.0);
    
    -- "2"
    Entity.GameEventPre(Game.GetRootEntity(), SSK1_COUNTDOWN_2, 0);   
    EntGame.BindCameraToEntity("CountdownCamera2");
    Script.WaitSec(1.0);
    
    -- "1"
    Entity.GameEventPre(Game.GetRootEntity(), SSK1_COUNTDOWN_1, 0);   
    EntGame.BindCameraToEntity("CountdownCamera1");
    Script.WaitSec(1.0);
    
    -- "HUNT!"  
    entCamera = Entity.FindName(entRoot, "MainCamera");
    EntGame.BindCameraToEntity(entCamera);    
    Camera.JumpToWaypoint(entCamera, "CamWptAA");
    Camera.SetSpeed(entCamera, 0.0, 0.01);    
    EntGame.BindInputToEntity("Player1");  
    Entity.GameEventPre(Game.GetRootEntity(), SSK1_COUNTDOWN_HUNT, 0);     
    Entity.GameEventPre(Game.GetRootEntity(), SSK1_START, 0);
 
    end;

-----------------------------------------------------------------------------
-- Use this function for overriding various game parameters (i.e. weapon availability, etc.)
function Testing()
    EntGame.SetPlayerWeapon(0, WS_PISTOL, 	    WID_PISTOL_2);
	EntGame.SetPlayerWeapon(0, WS_SINGLE_RIFLE, WID_SINGLE_RIFLE_2);
    EntGame.SetPlayerWeapon(0, WS_SHOTGUN,	    WID_SHOTGUN_1);	
	EntGame.SetPlayerWeapon(0, WS_AUTO_RIFLE, 	WID_AUTO_RIFLE_1);	
	EntGame.SetPlayerWeapon(0, WS_BOW, 		    WID_BOW_1);
	EntGame.ResetWeaponIcons();
	end;
	
-----------------------------------------------------------------------------

function Part1()
		
    Script.WaitSec(.75);

    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, 0, 0, 0, .6); 
    Script.WaitSec(.75);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -.5, 1, .5, .5);
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, .5, 2, -.5, .4); 
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -5, -1.2, 2.5, .2);   
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -5, 4, 2.5, .2);       
    Script.WaitSec(2.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, 0, 2, .3);   
    Script.WaitSec(1.0);
	
	--POWERUP
    Goose1 = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, -.5, 1, .5); 
    EntGame.CreateAnimalPowerUp(Goose1, PID_4X_MAGAZINE);
	
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, -1.5, 1, .3); 
    Script.WaitSec(3);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -.5, 1, .5, .5);
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, .5, -.6, -.5, .4); 
    Script.WaitSec(1.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -5, 1.5, 2.5, .2);   
    Script.WaitSec(2);
	
	--POWERUP
    Duck = EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseSPath09", 0, 0, 0, 0, .6);
    EntGame.CreateAnimalPowerUp(Duck, PID_WILEY_VISION_50);
	
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, 0, 1, .3);   
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, -.5, 1, .5); 
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, -1.5, 1, .3); 
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath06", 0, 0, 0, 0, .7); 
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath06", 0, 0, -1.5, 0, .4);     
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath06", 0, 0, 2.5, 0, .6);     
    Script.WaitSec(1);
	
	--POWERUP
    Duck1 = EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseSPath06", 0, 0, 5, 0, 1.0); 
    EntGame.CreateAnimalPowerUp(Duck1, PID_3X_RELOAD_RATE);
	
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath06", 0, -2, 0, 3.5, .4);     
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath06", 0, 2, 4.5, 0, .6); 
    Script.WaitSec(3);  
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath03", 0, 0, 0, 0, .6); 
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath04", 0, 0, 0, 0, .8); 
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath05", 0, 0, 0, 0, .6); 
    Script.WaitSec(1); 
    
    Camera.SetTiltOffset(entCamera, 20, 1.5);
    
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath03", 0, 2, -4.5, 0, .6); 
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath04", 0, 0, -2, 0, .6); 
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath05", 0, -1, -2, 1, .6);     
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath03", 0, 0, 0, 0, .6); 
    Script.WaitSec(1);
	
	--POWERUP
    Duck2 = EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseSPath03", 0, 0, 0, 0, .5); 
    EntGame.CreateAnimalPowerUp(Duck2, PID_WILEY_VISION_50);
	
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath04", 0, 0, 0, 0, .8); 
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath05", 0, 0, 0, 0, .6);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseLPath01", 0, 0, 3, 0, 1);   
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseLPath01", 0, -1.5, 2.5, 2.5, .8);
	Script.WaitSec(1);
	Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseLPath01", 0, 2.5, 2, -1.5, .6);
	Script.WaitSec(3);
    Camera.SetTiltOffset(entCamera, 0, 1.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath02", 0, 0, -1, 0, .6); 
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath02", 0, 0, -3, 0, .6); 
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath02", 0, 2, -6.5, -2, .4);    
    Script.WaitSec(2);  
	Duck3 = EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseSPath10", 0, 0, 0, 0, .7);
	Script.WaitSec(.5);
	Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath07", 0, 0, 8, 0, .6); 
	Script.WaitSec(1);
	Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath07", 0, 0, 9.5, 0, .3); 	
	Script.WaitSec(4.0);
	
	--POWERUP
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, 0, 2, .3);   
	EntGame.CreateAnimalPowerUp(Goose, PID_3X_FIRE_RATE);
	
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, -.5, 1, .5); 
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, -1.5, 1, .3); 
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath04", 0, 0, 0, 0, .8); 
   	Script.WaitSec(.5);
   	Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath04", 0, -1.5, 1.5, 3, .8); 
   	Script.WaitSec(2.5);
    EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseSPath09", 0, 0, 0, 0, .5);
    Script.WaitSec(2.5);    
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath05", 0, 0, 0, 0, .8); 
    Script.WaitSec(2);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath06", 0, 0, 0, 0, .8);
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath06", 0, -2, 1.5, .5, 1);
    Script.WaitSec(1);
	
	--POWERUP
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath06", 0, -.5, .5, 2, .8);
	EntGame.CreateAnimalPowerUp(Goose, PID_WILEY_VISION_50);
	
    Script.WaitSec(1.5);    
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath05", 0, 2, 2, 0, .6); 
    Script.WaitSec(1.0);    
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath05", 0, -2, 1, 0, .4);  
    Script.WaitSec(1.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath04", 0, 0, 0, 3, .8); 
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath04", 0, -1.5, 3, 0, .8); 
    Script.WaitSec(3);         	
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, 0, 2, .3);   
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, -.5, 1, .5);
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, 2, 1, .3); 
    Script.WaitSec(1);
    EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseSPath11", 0, 0, 0, 0, .5); 
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, 0, 2, 0, .6); 
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -.5, 1, .5, .5);
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, .5, 2, -.5, .4); 
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -5, -1.2, 2.5, .2);   
    Script.WaitSec(1.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -5, 4, 2.5, .2);       
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, 0, 2, .3);   
    Script.WaitSec(1.0);
	
	--POWERUP
    Powerup = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, -.5, 1, .5); 
	EntGame.CreateAnimalPowerUp(Powerup, PID_2X_SCORE);
	
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, 2, 1, .3); 
    Script.WaitSec(1.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseLPath02", 0, -.5, 1, .5, .5);
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseLPath02", 0, .5, -.6, -.5, .4); 
    Script.WaitSec(1.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath02", 0, -5, 1.5, 2.5, .2);   
    Script.WaitSec(2);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath02", 0, 0, 2, 0, .6); 
    Script.WaitSec(1);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath03", 0, -.5, 1, .5, .5);
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath03", 0, .5, 2, -.5, .4); 
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath03", 0, -5, 0, 2.5, .2);   
    Script.WaitSec(1.5);
	
	--POWERUP	
    Powerup = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath02", 0, -5, 4, 2.5, .2); 
    EntGame.CreateAnimalPowerUp(Powerup, PID_WILEY_VISION_50);
	
    Script.WaitSec(2.0);
	Goose = EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseMPath01", 0, -.5, -1, .5, .5);
	Script.WaitSec(2.0);
    EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseSPath09", 0, 0, 0, 0, .6);		
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, 0, 0, 0, .6); 
    Script.WaitSec(.75);
    Goose = EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseMPath01", 0, -.5, 1, .5, .5);
    Script.WaitSec(1.0);
	Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -.5, 1, .5, .5);
	Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseSPath01", 0, 0, 0, 2, .3);   
    Script.WaitSec(1.0);
    Goose = EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseSPath01", 0, 0, -.5, 1, .5); 
    Script.WaitSec(1.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -.5, 1, .5, .5);
    Script.WaitSec(.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, .5, -.6, -.5, .4); 
    Script.WaitSec(.75);
	Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, .5, -.8, -.5, .4);
	Script.WaitSec(.75);
    Goose = EntGame.SpawnBirdOnPath(AID_HARLEQUINN, "GooseMPath01", 0, -5, 1.5, 2.5, .2);   
    Script.WaitSec(1.5);
    Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, .5, 2, -.5, .8); 
    Script.WaitSec(1);
 	Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, -1.5, 0, 2, .6); 
 	Script.WaitSec(.5);
 	Goose = EntGame.SpawnBirdOnPath(AID_GOOSE, "GooseMPath01", 0, 0, -1, 0, .6);
 	
    end;
     
-----------------------------------------------------------------------------
-- Main entry point
   
Setup();   
Intro();
Part1();   

