コード例 #1
0
ファイル: InControlManager.cs プロジェクト: jds0102/GGJ2014
    // Use this for initialization
    void Start()
    {
        InputManager.Setup ();
        InputManager.AttachDevice( new UnityInputDevice( new KeyboardProfile() ) );
        if (singleton == null) {
            singleton = this;
        }

        //Whenever we have a device change we want to update the players
        InputManager.OnDeviceAttached += inputDevice => PlayerManager.m_singleton.DeviceChangeDetected ();
        InputManager.OnDeviceDetached += inputDevice => PlayerManager.m_singleton.DeviceChangeDetected ();
    }
コード例 #2
0
    void Start()
    {
        // This should only ever happen when testing in the Unity Editor, as there will be an InControlManager in the main menu and it will not be destroyed on load
        if (GameObject.Find("InControl Manager") == null)
        {
            InControlManager inControlManager = Instantiate(inControlManagerPrefab);
            inControlManager.name = "InControl Manager";
        }

        if (SceneManager.GetActiveScene().name == "Upgrade Menu" == false && SceneManager.GetActiveScene().name == "Main Menu" == false && SceneManager.GetActiveScene().name == "Thank You" == false)
        {
            deadCharactersParent = GameObject.Find("Dead Characters").transform;
        }
    }
コード例 #3
0
    private void InitStaticObjects()
    {
        if (!objectsInitialized)
        {
            DontDestroyOnLoad(gameObject);

            //Double check for every static variable
            if (debugMng == null)
            {
                //Debug.Log("Storing Debug Manager");
                debugMng = debugManager;
            }

            if (eventMng == null)
            {
                //Debug.Log("Storing Event Manager");
                eventMng = eventManager;
            }

            if (inputMng == null)
            {
                //Debug.Log("Storing Input Manager");
                inputMng = inputManager;
            }

            if (tutorialMng == null)
            {
                //Debug.Log("Storing Tutorial Manager");
                tutorialMng = tutorialManager;
            }

            if (audioMng == null)
            {
                //Debug.Log("Storing Audio Manager");
                audioMng = audioManager;
            }

            if (enemyMng == null)
            {
                //Debug.Log("Storing Enemy Manager");
                enemyMng = enemyManager;
            }

            if (poolMng == null)
            {
                //Debug.Log("Storing Pool Manager");
                poolMng = poolManager;
            }

            if (colorMng == null)
            {
                //Debug.Log("Storing Color Manager");
                colorMng = colorManager;
            }

            if (coloredObjectsMng == null)
            {
                //Debug.Log("Storing Colored Objects Manager");
                coloredObjectsMng = coloredObjectsManager;
            }

            if (rumbleMng == null)
            {
                //Debug.Log("Storing Rumble Manager");
                rumbleMng = rumbleManager;
            }

            if (gameMng == null)
            {
                //Debug.Log("Storing Game Manager");
                gameMng = gameManager;
            }

            if (voxelizationMng == null)
            {
                //Debug.Log("Storing Voxelization Manager");
                voxelizationMng = voxelizationManager;
            }

            if (statsMng == null)
            {
                //Debug.Log("Storing Stats Manager");
                statsMng = statsManager;
            }

            if (coroutineHlp == null)
            {
                //Debug.Log("Storing Coroutine Helper");
                coroutineHlp = coroutineHelper;
            }

            if (gameInfo == null)
            {
                gameInfo = new GameInfo();

                gameInfo.player1      = GameObject.Instantiate <GameObject>(player1prefab);
                gameInfo.player1.name = "Player1";
                DontDestroyOnLoad(gameInfo.player1);
                gameInfo.player1Controller = gameInfo.player1.GetComponent <PlayerController>();

                gameInfo.player2      = GameObject.Instantiate <GameObject>(player2prefab);
                gameInfo.player2.name = "Player2";
                DontDestroyOnLoad(gameInfo.player2);
                gameInfo.player2Controller = gameInfo.player2.GetComponent <PlayerController>();

                gameInfo.gameCameraOffset   = gameCameraOffset;
                gameInfo.gameCameraRotation = gameCameraRotation.rotation;
            }

            objectsInitialized = true;
        }
        else
        {
            DestroyImmediate(gameObject);
        }
    }
コード例 #4
0
ファイル: Grid.cs プロジェクト: mirrorfishmedia/GGJ2016
	// when the program launches, Grid will check that all the needed elements are in place
	// that's exactly what you do in the static constructor here:
	static Grid()
	{
		GameObject g;


		//		g = safeFind("__dimensionManager");
		//		dimensionManager = (DimensionManager)SafeComponent( g, "DimensionManager" );
		//		
		//		g = safeFind("__randomSeed");
		//		randomSeed = (RandomSeed)SafeComponent( g, "RandomSeed" );
		//		
		g = safeFind("__GameMan");
		gameMan = (GameMan)SafeComponent( g, "GameMan" );
		g = safeFind("__InControl");
		icMan = (InControlManager)SafeComponent( g, "InControlManager" );
		g = safeFind("__SoundMan");
		//soundMan = (SoundMan)SafeComponent( g, "SoundMan" );


		// PS. annoying arcane technical note - remember that really, in c# static constructors do not run
		// until the FIRST TIME YOU USE THEM.  almost certainly in any large project like this, Grid
		// would be called zillions of times by all the Awake (etc etc) code everywhere, so it is
		// a non-issue. but if you're just testing or something, it may be confusing that (for example)
		// the wake-up alert only appears just before you happen to use Grid, rather than "when you hit play"
		// you may want to call "SayHello" from the GeneralOperations.cs, just to decisively start this script.
	}
コード例 #5
0
	//private InControl.InControlManager manager;

	void Start ()
	{
//		manager = new InControl.InControlManager ();
//		manager.customProfiles.Add("KeyboardProfile1");
//		manager.customProfiles.Add("KeyboardProfile2");
//		manager.customProfiles.Add("CustomProfile");

//		List<InputDevice> devicesToDetach = new List<InputDevice> ();
//		if (SystemInfo.operatingSystem.ToUpper().Contains("WINDOWS"))
//		{
//			bool detachNext = false;
//			for (int i = 0; i < InputManager.Devices.Count; i++)
//			{
//				InputDevice input = InputManager.Devices[i];
//				if ((input.Name == "XBox 360 Controller") && (!detachNext))
//				{
//					detachNext = true;
//					continue;
//				}
//				if (detachNext)
//				{
//					devicesToDetach.Add(input);
//					detachNext = false;
//				}
//			}
//		}

//		InputManager.AttachDevice( new UnityInputDevice( new KeyboardProfile1() ) );
//		InputManager.AttachDevice( new UnityInputDevice( new KeyboardProfile2() ) );
//		InputManager.AttachDevice( new UnityInputDevice( new CustomProfile() ) );

//		foreach(InputDevice device in InputManager.Devices)
//		{
//			Debug.Log("Attached device:" + device.Name);
//		}
//		
//		foreach(InputDevice device in devicesToDetach)
//		{
//			InputManager.DetachDevice(device);
//			Debug.Log("Detached device:" + device.Name);
//		}

		instance = this;

		if (Application.loadedLevel == 0)
		{
			currentPlayer = 1;
			LevelFinishedController.instance.setControllers(new List<InputController> ());
			//TextMesh levelScreen = GameObject.Find ("Level").GetComponent<TextMesh>();
			//levelScreen.text = "Zone " + (LevelFinishedController.instance.getLevel() + 1) + "/" + LevelFinishedController.instance.getTotalLevels();
			if (LevelFinishedController.instance.getMaxLevel() == 0 && LevelFinishedController.instance.getEnableAllLevels() == false)
			{
				GameObject.Find ("StickContainer").SetActive(false);
			}
		}

		foreach(InputController inputController in LevelFinishedController.instance.getAllControllers())
		{
			inputController.updatePlayer();
		}
	}