Пример #1
0
    // Use this for initialization
    void Start()
    {
        // set the instance of me
        _manager = this;

        _myRoot  = GetComponentInChildren <UIRoot>();
        _myPanel = GetComponentInChildren <UIPanel>();

        Init();
    }
Пример #2
0
    // Use this for initialization
    void Awake()
    {
        //Set ourselves.
        Pandora = this;

        TimePaused = true;
//		Debug.LogError("Toybox Start");

        //Create an audioplayer if we dont ahve one.
        if (AudioPlayer.GetPlayer() == null)
        {
            SoundAudioPlayer = Instantiate(SoundAudioPlayer) as AudioPlayer;
        }

        //Lets just always create the toybox at normal scale.
        //Time.timeScale = timescalenormal;

        //Create the gem pot manager
        Rewards = Instantiate(Rewards) as GemPotManager;

        if (Controls)
        {
            //Little local storage to test if joystick has been found.
            bool found = false;

            //See if there is one in the scene first.
            foreach (Object o in FindObjectsOfType(typeof(Joystick)))
            {
                if (o.name == "TOYBOX_JOYSTICK")
                {
                    Controls = (Joystick)o;
                    found    = true;
                }
            }

            //If nothign was found then this is the first time.
            if (!found)
            {
                //Create and name.
                Controls      = Instantiate(Controls) as Joystick;
                Controls.name = "TOYBOX_JOYSTICK";

                //Keep us alive just because man.
                DontDestroyOnLoad(Controls.gameObject);
            }
        }


        ///////// Bot Creation ///////

        //Create the command center.
        CommandCenter_01 = Instantiate(CommandCenter_01) as CommandCenter;

        if (!CreateCommandCenter)
        {
            CommandCenter_01.gameObject.SetActive(false);
        }

        //Create the bot
        Bot_01 = Instantiate(Bot_01) as BasicBot;


        //Create the shield
        BotShield_01 = Instantiate(BotShield_01) as SimpleShield;

        //Attach the shield to the bot.

        Bot_01.SetDefenseUnit(BotShield_01);

        //Trigger the spawns and store them in the cannon list.



        ///////// Bot Creation ///////



        /////////Scene Setup//////////

//		Camera_01 = GameObjectTracker.instance.GameCamera;
//
//
//		if(Camera_01)
//		{
//			//Set teh camera to look at the bot.
//			Camera_01.SetBotToFollow(Bot_01);
//
//			//Set teh game camera as the current game camera.
//			Camera.SetupCurrent(Camera_01.MyCamera);
//		}
//
        //Create the ball stack and yeah...
        SceneBallStack = Instantiate(SceneBallStack) as BallStack;

        /////////Scene Setup//////////


        //Create the NGUI last

        if ((FUIHud && createFUI) && ActivityManager.Instance == null)
        {
            FUIHud = Instantiate(FUIHud) as UIRoot;

            //What happens if we dont destroy?
            DontDestroyOnLoad(FUIHud.gameObject);
        }
        else
        {
            //If the activitiy manager is alrady crated and is not active, then we simply activate.
            if (ActivityManager.Instance.SetActive == false)
            {
                ActivityManager.Instance.SetActive = true;

                //here we should activate the gameplay world as well.
                GameObjectTracker.GetGOT().World.gameObject.SetActive(true);
            }
        }


        if (fui3DManager && createFui3D)
        {
            fui3DManager = Instantiate(fui3DManager) as FUI3DManager;
        }

        if (MyPowerUpSpawner == null)
        {
            Debug.LogError("No powerup spawner in testgame");
        }
//		Debug.LogError("Toybox End");
    }