void Start()
 {
     if (Instance == null) {
         Instance = this;
     }
     m_currentSwingState = SwingState.Unstarted;
     m_arrow = GameObject.Instantiate (m_arrowPrefab);
     m_arrow.transform.localScale = m_arrow.transform.localScale * 0.6f;
     m_crumbOne = GameObject.Instantiate (m_arrowPrefab);
     m_crumbOne.transform.localScale = m_crumbOne.transform.localScale * 0.8f;
     m_crumbTwo = GameObject.Instantiate (m_arrowPrefab);
     m_crumbTwo.transform.localScale = m_crumbTwo.transform.localScale * 1.0f;
 }
Example #2
0
    //private void Update()
    //{
    //    if (GameManager.Instance.loadLevelComplete == true)
    //    {
    //        //GameManager.Instance.loadLevelComplete = false;
    //        Debug.Log("Load level complete is true");

    //        actionManager = GameObject.Find("LevelManager").GetComponent<ActionsManager>();

    //        Debug.Log("Found the level Manager");

    //        PlayInitialCue(actionManager.nextCue, actionManager.currentAction);


    //        if (actionManager.currentAction != "None")
    //        {

    //        }
    //    }

    //}


    /// <summary>
    /// PLEASE LOOK INTO THIS ONTRIGGER. WHAT'S REALLY NECESSARY
    /// </summary>
    private void OnTriggerEnter(Collider other)
    {
        TriggerScript ts = other.GetComponent <TriggerScript>();


        if (ts != null)
        {
            if (ts.action == "")
            {
                if (ts.playFrom != null)
                {
                    AkSoundEngine.PostEvent(ts.eventName, ts.playFrom);
                    //other.gameObject.SetActive(false);
                }
                else
                {
                    AkSoundEngine.PostEvent(ts.eventName, gameObject);
                    //other.gameObject.SetActive(false);
                }
            }

            if (ts.action != "")
            {
                if (ts.eventName != "")
                {
                    AkCallbackManager.EventCallback newActionEvent;
                    newActionEvent = new AkCallbackManager.EventCallback(new System.Action <object, AkCallbackType, object>((o1, o2, o3) => PlayCueEventCompleted(ts.action)));
                    AkSoundEngine.PostEvent(ts.eventName, gameObject, (uint)AkCallbackType.AK_EndOfEvent, newActionEvent, null);
                    //other.gameObject.SetActive(false);
                }
                else
                {
                    PlayCueEventCompleted(ts.action);
                    //other.gameObject.SetActive(false);
                }
            }

            ChangeBehaviourMoveState(ts.movementStatus);
        }

        if (other.gameObject.name == "SceneEnd")
        {
            if (ts != null)
            {
                AkSoundEngine.StopAll(gameObject);
                AkCallbackManager.EventCallback cutscene_endScene = new AkCallbackManager.EventCallback(new System.Action <object, AkCallbackType, object>((o1, o2, o3) => SceneEnd()));
                AkSoundEngine.PostEvent(ts.eventName, gameObject, (uint)AkCallbackType.AK_EndOfEvent, cutscene_endScene, null);
            }
            else
            {
                SceneEnd();
            }
        }

        if (other.gameObject.name == "Well_To_Forest")
        {
            AkSoundEngine.PostEvent("Well_Forest", gameObject);

            uint eventId;
            eventId = AkSoundEngine.GetIDFromString("Home_To_Well");
            AkSoundEngine.ExecuteActionOnEvent(eventId, AkActionOnEventType.AkActionOnEventType_Stop, gameObject, 0, AkCurveInterpolation.AkCurveInterpolation_Linear);
        }

        if (other.gameObject.name == "JumpTheTree")
        {
            GameObject bootMusic = GameObject.Find("Boot Music");

            uint eventId;
            eventId = AkSoundEngine.GetIDFromString("global_bg");
            AkSoundEngine.ExecuteActionOnEvent(eventId, AkActionOnEventType.AkActionOnEventType_Stop, bootMusic, 5, AkCurveInterpolation.AkCurveInterpolation_Linear);


            AkCallbackManager.EventCallback pauseBgMusic = new AkCallbackManager.EventCallback(new System.Action <object, AkCallbackType, object>((o1, o2, o3) => ResumeBGMusic()));
            AkSoundEngine.PostEvent("tree_fall_music", bootMusic, (uint)AkCallbackType.AK_EndOfEvent, pauseBgMusic, null);
        }

        if (other.gameObject.name == "WellMusic")
        {
            GameObject bootMusic = GameObject.Find("Boot Music");

            uint eventId;
            eventId = AkSoundEngine.GetIDFromString("global_bg");
            AkSoundEngine.ExecuteActionOnEvent(eventId, AkActionOnEventType.AkActionOnEventType_Stop, bootMusic, 5000, AkCurveInterpolation.AkCurveInterpolation_Linear);


            AkCallbackManager.EventCallback pauseBgMusic = new AkCallbackManager.EventCallback(new System.Action <object, AkCallbackType, object>((o1, o2, o3) => ResumeBGMusic()));
            AkSoundEngine.PostEvent("well_music", bootMusic, (uint)AkCallbackType.AK_EndOfEvent, pauseBgMusic, null);
        }

        if (other.gameObject.name == "MusicFour")
        {
            GameObject bootMusic = GameObject.Find("Boot Music");

            uint eventId;
            eventId = AkSoundEngine.GetIDFromString("global_bg");
            AkSoundEngine.ExecuteActionOnEvent(eventId, AkActionOnEventType.AkActionOnEventType_Stop, bootMusic, 5000, AkCurveInterpolation.AkCurveInterpolation_Linear);


            AkCallbackManager.EventCallback pauseBgMusic = new AkCallbackManager.EventCallback(new System.Action <object, AkCallbackType, object>((o1, o2, o3) => ResumeBGMusic()));
            AkSoundEngine.PostEvent("cutscene_four_music", bootMusic, (uint)AkCallbackType.AK_EndOfEvent, pauseBgMusic, null);
        }

        if (other.gameObject.name == "Forest_Chase")
        {
            //AkSoundEngine.PostEvent("Forest_Chase", gameObject);

            uint eventId;
            eventId = AkSoundEngine.GetIDFromString("Well_Forest");
            AkSoundEngine.ExecuteActionOnEvent(eventId, AkActionOnEventType.AkActionOnEventType_Stop, gameObject, 5000, AkCurveInterpolation.AkCurveInterpolation_Linear);
        }


        if (other.gameObject.name == "SwingStart")
        {
            SwingHandler         sh         = other.GetComponent <SwingHandler>();
            AnimationEventScript animEvents = sh.swing.GetComponent <AnimationEventScript>();
            if (animEvents != null)
            {
                animEvents.canListenForEvents = true;
            }

            //other.gameObject.SetActive(false);
        }

        if (other.gameObject.name == "SwingEnd")
        {
            //other.gameObject.SetActive(false);
            SwingHandler         sh         = other.GetComponent <SwingHandler>();
            AnimationEventScript animEvents = sh.swing.GetComponent <AnimationEventScript>();
            if (animEvents != null)
            {
                animEvents.canListenForEvents = false;
                AkSoundEngine.PostEvent("Move_On", gameObject);
            }
        }

        other.gameObject.SetActive(false);
    }