상속: MonoBehaviour
예제 #1
0
	static void CreateInstance(){
		_Instance = GameObject.FindObjectOfType(typeof(GestureManager)) as GestureManager;
		if (_Instance == null){
			GameObject CGO = Camera.main.gameObject;
			_Instance = CGO.AddComponent<GestureManager>();
		}
		_Instance.listeners = new List<RegisteredListener>();
	}
        private void Awake()
        { 
            gestureManager = GestureManager.Instance;

            if (gestureManager == null)
            {
                Debug.LogError(string.Format("GestureManipulator on {0} could not find GestureManager instance, manipulation will not function", name));
            }
        }
예제 #3
0
    // Use this for initialization
    void Awake()
    {
        stand = new StandTutorial (tutor);
        sit = new SitTutorial (tutor);

        Debug.Log("Initializing Kinect");
        try
        {
            GameKinectSensor = new OhioState.Kinect.KinectSensor();
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
        }

        currentKinectGameData = new KinectGameData();

        try
        {
            GameKinectSensor.SkeletonHandler += kinectSensor_SkeletonFrameReady;
            GameKinectSensor.Initialize();
        }
        catch (Exception e)
        {
            Debug.LogError(e.Message);
        }

        DontDestroyOnLoad(this.gameObject);
        int size = 5 * 60;
        gestureManager = new GestureManager(size, true);

        gestureManager.Level = 1;
        gestureManager.ReadFiles();
        //if (gestureManager.ErrorMessage.Length > 0)
        //    Debug.LogError(gestureManager.ErrorMessage);
        SetGesturesForSection("tutorial");
        Debug.Log("Kinect Complete");
    }
예제 #4
0
    // Use this for initialization
    void Awake()
    {
        Debug.Log("Initializing Kinect");
        try
        {
            GameKinectSensor = new OhioState.Kinect.KinectSensor();
        }
        catch (Exception e)
        {
            errorMessage = e.Message;
            Debug.LogError(e.Message);
        }

        currentKinectGameData = new KinectGameData();

        try
        {
            GameKinectSensor.SkeletonHandler += kinectSensor_SkeletonFrameReady;
            GameKinectSensor.Initialize();
        }
        catch (Exception e)
        {
            errorMessage = e.Message;
            Debug.LogError(e.Message);
        }

        int size = 5 * 60;
        gestureManager = new GestureManager(size, true);

        gestureManager.Level = 1;
        gestureManager.ReadFiles();
        //if (gestureManager.ErrorMessage.Length > 0)
        //    Debug.LogError(gestureManager.ErrorMessage);
        SetGesturesForSection(sectionName);
        Debug.Log("Kinect: " + GameKinectSensor.Status);
    }
예제 #5
0
		public void Start ()
		{	
			// initialize tables
			EventReader.GetInstance();
			ReactionReader.GetInstance();
			SequenceReader.GetInstance();
			AffectedActionReader.GetInstance();
			MoodPointsReader.GetInstance();
			ReactionTrackingReader.GetInstance();
			TutorialReader.GetInstance();
			
			ResponseManager.Instance.HideIcon();
			InstructionsManager.Instance.HideInstruction();
			
			// hold instance
			m_instance = this;
			
			//Load intro rocks
			m_introRock = Instantiate( Resources.Load( "AnimationTool/INTRO_ROCK" ) ) as GameObject;
			m_introRock.SetActive( false );
			
			// init anim controller utility
			GameObject cfController = GameObject.Find("CAREPLAY_NF_Controller") as GameObject;
			cfController.AddComponent<CarePlayNFController>();
			cfController.AddComponent<BiteItemController>();
			
			// init cam controller utility
			m_cameraController = GameObject.Find ("CAREPLAY_Cam_Controller").GetComponent<CameraRigController>();
			
			// init dragon
			m_petDragon = GameObject.FindGameObjectWithTag("PetDragon") as GameObject;
			m_petDragon.gameObject.AddComponent<DragonScript>();
			m_petDragon.gameObject.AddComponent<DragonAnimation>();
			m_petDragon.gameObject.AddComponent<Dragon>();
			m_petDragon.gameObject.AddComponent<JawCruncherStateController>();

			m_jcController = m_petDragon.gameObject.GetComponent<JawCruncherStateController>();
			
			// init gestures
			m_mainCamera = GameObject.FindGameObjectWithTag("MainCamera").gameObject;
			m_mainCamera.AddComponent<GestureManager>();
			m_gestureManager = Camera.mainCamera.gameObject.GetComponent<GestureManager>();
			m_gestureManager.g_pettingListener = this.GestureListener;
			m_gestureManager.SetPettingDelegate(this);
			CameraController.Instance.SetPettingDelegate(this);
			//m_gestureManager.DisableGestures();
			
			// init bridge items
			m_sheepManager 			= GameObject.Find("SheepManager").GetComponent<SheepManager>();
			m_sheepManager.InitializeSheep();
			
			// init dragon collider
			GameObject HeadCollider = (GameObject)Resources.Load("Prefabs/Petting/DragonColliders/HeadCollider");
			GameObject BodyCollider = (GameObject)Resources.Load("Prefabs/Petting/DragonColliders/BodyCollider");
			m_dragonHeadCollider 	= GameObject.Instantiate(HeadCollider) as GameObject;
			m_dragonBodyCollider 	= GameObject.Instantiate(BodyCollider) as GameObject;
			
			m_dragonHeadCollider.transform.parent = m_petDragon.transform.Find("joint_Spine/joint_Neck/joint_Head").transform;
			m_dragonHeadCollider.name = "HeadCollider";
			m_dragonHeadCollider.transform.localPosition 	= new Vector3(-0.00785967f, -0.03883493f, 0.2275544f);
			m_dragonHeadCollider.transform.localRotation 	= Quaternion.Euler(new Vector3(335.4119f, 184.195f, 1.887401f));
			m_dragonHeadCollider.transform.localScale 		= new Vector3(0.6969064f, 0.4911779f, 1.063113f);
			m_dragonBodyCollider.transform.parent = m_petDragon.transform.Find("joint_Spine").transform;
			m_dragonBodyCollider.name = "BodyCollider";
			m_dragonBodyCollider.transform.localPosition 	= new Vector3(0.0176101f, -0.2866409f, -0.8635432f);
			m_dragonBodyCollider.transform.localRotation 	= Quaternion.Euler(new Vector3(270.0f, 180.0f, 0.0f));
			//m_dragonBodyCollider.transform.localScale 		= new Vector3(1.043613f, 1.421112f, 1.043613f);
			
			//init camera focus point
			m_cameraFocusPoint = new GameObject ( "FocusPoint" );
			m_cameraFocusPoint.tag = "ToothlessFocusPoint";
			GameObject toothlessAxis = GameObject.Find("joint_Spine");
			m_cameraFocusPoint.transform.parent = toothlessAxis.transform;
			m_cameraFocusPoint.transform.position = toothlessAxis.transform.position;
			m_cameraFocusPoint.transform.rotation = Quaternion.identity;
			
			//Sound audio source container
			m_headSoundContainer = new GameObject( "SoundContainer_Head" );
			m_headSoundContainer.transform.parent = toothlessAxis.transform;
			m_headSoundContainer.transform.position = toothlessAxis.transform.position;
			m_headSoundContainer.transform.rotation = Quaternion.identity;
			
			m_bodySoundContainer = new GameObject( "SoundContainer_Body" );
			m_bodySoundContainer.transform.parent = toothlessAxis.transform;
			m_bodySoundContainer.transform.position = toothlessAxis.transform.position;
			m_bodySoundContainer.transform.rotation = Quaternion.identity;
			
			m_headAndBodySoundContainer = new GameObject( "SoundContainer_HeadAndBody" );
			m_headAndBodySoundContainer.transform.parent = toothlessAxis.transform;
			m_headAndBodySoundContainer.transform.position = toothlessAxis.transform.position;
			m_headAndBodySoundContainer.transform.rotation = Quaternion.identity;
			
			// Camera Look Points
			GameObject cHead		  		= new GameObject( "CamPlayerHead" );
			GameObject cBody		  		= new GameObject( "CamPlayerBody" );
			GameObject cLeft		  		= new GameObject( "CamPlayerLeft" );
			GameObject cRight				= new GameObject( "CamPlayerRight" );
			
			cHead.tag 				  		= "CamPlayerHead";
			cBody.tag 				  		= "CamPlayerBody";
			cLeft.tag 				  		= "CamPlayerLeft";
			cRight.tag 				  		= "CamPlayerRight";
			
			cHead.transform.parent 			= m_mainCamera.gameObject.transform;
			cBody.transform.parent 			= m_mainCamera.gameObject.transform;
			cLeft.transform.parent 			= m_mainCamera.gameObject.transform;
			cRight.transform.parent 		= m_mainCamera.gameObject.transform;
			
			cHead.transform.localPosition 	= new Vector3( 0.0f, 0.30f, 0.0f );
			cBody.transform.localPosition 	= new Vector3( 0.0f, -0.30f, 0.0f );
			cLeft.transform.localPosition 	= new Vector3( -1.2f, 0.0f, 0.0f );
			cRight.transform.localPosition 	= new Vector3( 1.2f, 0.0f, 0.0f );
			
			cHead.transform.localScale 		= new Vector3( 0.001f, 0.001f, 0.001f );
			cBody.transform.localScale 		= new Vector3( 0.001f, 0.001f, 0.001f );
			cLeft.transform.localScale 		= new Vector3( 0.001f, 0.001f, 0.001f );
			cRight.transform.localScale 	= new Vector3( 0.001f, 0.001f, 0.001f );
			
			
			// Dragon Look Points
			GameObject lookL 				= new GameObject( "DLookL" );
			GameObject lookR 				= new GameObject( "DLookR" );
			
			lookL.tag						= "DLookL";
			lookR.tag						= "DLookR";
			
			lookL.transform.parent 			= m_petDragon.transform;
			lookL.transform.position 		= new Vector3( 3.50f, 2.00f, -1.00f );
			
			lookR.transform.parent 			= m_petDragon.transform;
			lookR.transform.position 		= new Vector3( -3.50f, 2.00f, -1.00f );
			
			// init ui
			m_uiRefs						= new Hashtable();
			m_carePlayUI 					= GameObject.Find("CareAndPlayHUD") as GameObject;
			m_carePlayUI.GetComponent<CareAndPlayHUD>();
			m_carePlayUI.GetComponent<GamePauseManager>().PauseCallBack = this.PauseGame;
			
			m_carePlayTab					= GameObject.Find("MainTab") as GameObject;
			
			m_uiManager						= m_carePlayUI.AddComponent<CarePlayUIManager>();
			m_uiManager.Initialize();
			m_uiManager.SetCB_Call(this.OnDragonCall);
			m_uiManager.SetCB_Book(this.OnBookOfDragon);
			m_uiManager.SetCB_Inventory(this.OnInventory);
			m_uiManager.SetCB_Inventory_Close(this.OnInventoryClose);
			m_uiManager.SetCB_Map(this.OnMap);
			m_uiManager.SetCB_Profile(this.OnProfile);
			m_uiManager.SetCB_Profile_Close(this.OnProfileClose);
			
			m_tabManager					= m_carePlayTab.GetComponent<CarePlayTabManager>();
			
			m_energyGauge 					= GameObject.Find("EnergyProgress") as GameObject;
			m_bondGauge						= GameObject.Find("BondProgress") as GameObject;
			m_energyBondUI					= GameObject.Find("EnergyBond") as GameObject;
			m_pauseUI						= GameObject.Find("PauseBTN") as GameObject;
			
			StatsManager.Instance.EnergyGauge	= m_energyGauge.GetComponent<EnergyProgress>();
			StatsManager.Instance.BondGauge		= m_bondGauge.GetComponent<BondProgress>();
			
			// UI finger tap
			m_uiFingerSingleTap				= GameObject.Find("SingleTapFinger") as GameObject;
			m_uiFingerDoubleTap 			= GameObject.Find("DoubleTapFinger") as GameObject;
			m_uiFingerHold					= GameObject.Find("HoldFinger") as GameObject;
			
			m_uiFingerSingleTap.transform.parent.localPosition = new Vector3( -6.043911e-05f, 319.0215f, 0f );
			
			m_uiFingerSingleTap.SetActive(false);
			m_uiFingerDoubleTap.SetActive(false);
			m_uiFingerHold.SetActive(false);
			
			// set inventory callbacks
			InventoryUIHandler.OnFeedingItemCallback 	= this.OnFeedingItem;
  			InventoryUIHandler.OnFetchingItemCallback 	= this.OnFetchingItem;
			InventoryUIHandler.OnCarePlayItemCallback 	= this.OnCarePlayItem;
			
			// set Hud Callback to enable gestures
			//m_carePlayUI.GetComponent<CareAndPlayHUD>().SetDialogCloseCB(m_gestureManager.EnableGestures);
			
			// init dragon animation controller
			m_dragonAnimScript = m_petDragon.gameObject.GetComponent<DragonScript>();
			m_dragonAnimScript.SetPettingDelegate(this);
			
			// init dragon animation
			m_dragonAnimation = m_petDragon.gameObject.GetComponent<DragonAnimation>();
			m_dragonAnimation.SetPettingDelegate(this);
			
			m_petDragon.GetComponent<JawCruncherStateController>().SetPettingDelegate( this );
			
			// init dragon animation tool
			DragonAnimationQueue.getInstance().SetDAnim(m_petDragon.gameObject.GetComponent<DragonAnimation>());
			DragonAnimationQueue.getInstance().SetPettingDelegate(this);
			
			// initialize DragonStateMachine
			m_dragonStateMachine = m_petDragon.gameObject.GetComponent<Dragon>();
			m_dragonStateMachine.SetPettingDelegate(this);
			m_dragonStateMachine.Initialize();
			
			// initialize DragonScript
			m_dragonAnimScript.Initialize();
			
			// Setup Pausables
			m_petDragon.AddComponent<Pausable>();
			m_mainCamera.AddComponent<Pausable>();
			
			// reset values
			StatsManager.Instance.DragonMode = StatsManager.MODE_NORMAL; // - LA
			//StatsManager.Instance.DragonMode = StatsManager.MODE_ACT1; // - LA
			
			// on start of touchplay, always set interactive to true
			m_dragonStateMachine.SetIsInteractible(true);
			
			// Swipe UI
			m_swipeUI				= GameObject.Find("SwipeUI");
			m_swipeHolder			= GameObject.Find("SwipeHolder");
			m_swipeFingerGO			= GameObject.Find("SwipeFinger");
			m_swipeFinger			= m_swipeFingerGO.GetComponent<TweenPosition>();
		    m_swipeUITexture		= m_swipeUI.GetComponent<UITexture>();
			m_swipeUITexture.alpha	= 0.3f;
			m_swipeHolder.SetActive(false);
			
			m_swipeUI.GetComponent<UITexture>().alpha 		= 0.5f;
			m_swipeFingerGO.GetComponent<UITexture>().alpha = 0.75f;
		
			
			//Double Tap UI
			m_doubleTapTweenPos 	= GameObject.Find("DoubleTapUI").GetComponent<TweenPosition>();
			
			GameObject successIcon	= GameObject.Find("SuccesIcon");
			UISprite spriteSucccessIcon = successIcon.GetComponent<UISprite>();
			spriteSucccessIcon.alpha = 0.0f;
			m_successIconTweenAlpha = successIcon.GetComponent<TweenAlpha>();
			m_successIconTweenAlpha.onFinished=ResetSuccesAnimation;
			
			// hide UIs
			this.HideUI("DCall");
			
			// Handle Timer for Usage Tracker
			m_usageTrackerScheduler = S6Scheduler.ScheduleAction( this, StatsManager.Instance.UpdateTrackers, 0.5f, S6Scheduler.INFINITE, false);
			
			// update dragon mood for Animation Controllers
			StatsManager.Instance.UpdateMood();
			
			// load objects
			// fish
			m_fishItems.Add(this.CreateObject( "Fish", 							"Prefabs/Feeding/FeedingFish", 1.0f));
			
			// chicken
			m_chickenItems.Add(this.CreateObject( "ChickenLeg", 				"Prefabs/Feeding/FeedingChickenLeg", 1.0f));
			m_chickenItems.Add(this.CreateObject( "ChickenThigh", 				"Prefabs/Feeding/FeedingChickenThigh", 1.0f));
			m_chickenItems.Add(this.CreateObject( "ChickenWing", 				"Prefabs/Feeding/FeedingChickenWing", 1.0f));
			
			// seafood
			m_seafoodItems.Add(this.CreateObject( "Crab", 						"Prefabs/Feeding/FeedingCrab", 1.0f));
			m_seafoodItems.Add(this.CreateObject( "Lobster", 					"Prefabs/Feeding/FeedingLobster", 1.0f));
			m_seafoodItems.Add(this.CreateObject( "Shrimp", 					"Prefabs/Feeding/FeedingShrimp", 1.0f));
			
			// fruits & veggies
			m_fruitsAndVeggiesItems.Add(this.CreateObject( "FruitsAndVeggies", 	"Prefabs/Feeding/FeedingOrange", 1.0f));
			m_fruitsAndVeggiesItems.Add(this.CreateObject( "FruitsAndVeggies", 	"Prefabs/Feeding/FeedingPeach", 1.0f));
			m_fruitsAndVeggiesItems.Add(this.CreateObject( "FruitsAndVeggies", 	"Prefabs/Feeding/FeedingTurnip", 1.0f));
			
			// fetching items
			m_fetchingItems.Add(this.CreateObject( "Boomerang", 				"Prefabs/Fetching/Boomerang", 1.0f));
			
			// adjust boomerang transform
			m_fetchingItems[0].transform.parent			= Camera.main.transform;
			m_fetchingItems[0].transform.localPosition 	= new Vector3( -0.05178565f, -0.51644f, 1.536007f );
			m_fetchingItems[0].transform.localRotation 	= Quaternion.Euler(new Vector3( 0.0f, 283.0f, 69.99999f ));
			
			// Handle disable/enable of gestures during hide/show of overlays
			// These methods are called during the initial add & remove of overlays.
			ScreenManager.Instance.OnDisplayOverlay = () => 
			{
				switch( TutorialController.GTutState )
				{
					case TutorialController.ETutorialState.BondMeterIntro:
					case TutorialController.ETutorialState.PlayerProfileIntro:
						// don't update gestures during this state of tutorial
					break;
					default:
						m_gestureManager.DisableGestures();
					break;
				}
			};
			
			ScreenManager.Instance.OnHideOverlay = () => 
			{
				switch( TutorialController.GTutState )
				{
					case TutorialController.ETutorialState.BondMeterIntro:
					case TutorialController.ETutorialState.PlayerProfileIntro:
						// don't update gestures during this state of tutorial
					break;
					default:
						m_gestureManager.EnableGestures();
					break;
				}
			};
			
			// Check Scenes
			this.HandleScenes();
		}
 public override void Start()
 {
     base.Start();
     controller = new Controller();
     gestureManager = new GestureManager(controller);
 }
예제 #7
0
    /* static int rowState = Animator.StringToHash("Base Layer.Row");
    static int gyroState = Animator.StringToHash("Base Layer.Gyro");
    TODO: implement at a later date 2015-04-02
    */
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------
    // Functions
    //------------------------------------------------------------------------------------------------------------------------------------------------------------------
    void Start()
    {
        playerRobot = GameObject.Find ("PlayerRobot");
        peAccessor = playerRobot.GetComponent<PlayerEnergy>();
        playerMover = playerRobot.GetComponent<SWS.PlayerSplineMove> ();
        gestureManager = GameObject.Find ("GestureManager").GetComponent<GestureManager>();
        oldPosX = playerRobot.transform.position.x;
        oldPosZ = playerRobot.transform.position.z;
        moveSpeed = 0.0f;

        //initialising reference variables
        anim = GetComponent<Animator> ();
        if (anim.layerCount == 2) {
            anim.SetLayerWeight (1, 1);
        }

        switch (Application.loadedLevel){
        case 0:
            playerMover.events[1].AddListener(delegate{pauseMovement(4f); GameObject.Find ("MainCamera").GetComponent<ThirdPersonCamera>().callDoorZoom();});
            break;
        case 1:
            playerMover.startPoint = 0;
            playerMover.SetPath(WaypointManager.Paths["Level02_Room01_Path01"]);
            playerMover.speed = 5.5f;
            playerMover.lockRotation = AxisConstraint.X;

            anim.SetBool("IsWalking", true);
            playerMover.StartMove();

            playerMover.events[3].AddListener(delegate() {pauseMovement(.8f); callJumping();});
            playerMover.events[4].AddListener(delegate() {pauseMovement(1.5f);});
            playerMover.events[5].AddListener(delegate() {callRowing (); stopMovement(.7f);});
            break;
        case 2:

            break;
        default:
            return;
        }
    }
예제 #8
0
	void Awake(){
		// find or make instance of singleton
		_Instance=this;
		if (listeners == null)
			listeners = new List<RegisteredListener>();
	}
예제 #9
0
파일: FinManager.cs 프로젝트: PKode/Kinect
 // Use this for initialization
 void Start()
 {
     gestureManager = GameObject.Find("KinectPointMan").GetComponent<GestureManager>();
     rightTime = 0.0f;
     leftTime = 0.0f;
 }
예제 #10
0
 // Use this for initialization
 void Start()
 {
     blink = 0.0f;
     gestureManager = GameObject.Find("KinectPointMan").GetComponent<GestureManager>();
     ball = gameObject.GetComponent<Ball> ();
 }
예제 #11
0
	public void Awake(){
		Instance = this;
	}
예제 #12
0
 void Start()
 {
     animator = GetComponent<Animator>();
     g = GameObject.Find("BattleController").GetComponent<GestureManager>();
     g.OnGestureTap += OnGestureTap;
     g.OnGestureMove += OnGestureMove;
 }