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(); }