void startTutorial()
    {
        Time.timeScale = 0f;
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        if (player == null)
        {
            Debug.Log("Could not find player");
        }
        pScript = player.GetComponent <playerControllerCopy>();
        if (pScript == null)
        {
            Debug.Log("Could not find pScript");
        }

        iScript = player.GetComponentInChildren <InteractionControllerCopy>();
        if (iScript == null)
        {
            Debug.Log("Could not find the ineteractioncontroller");
        }
        GameObject[] monsters = GameObject.FindGameObjectsWithTag("Monster");
        foreach (GameObject mons in monsters)
        {
            AudioSource roamSound = mons.transform.Find("Audio Source")
                                    .GetComponent <AudioSource>();
            roamSound.enabled = false;
        }
        pScript.setInTutorial(true);
        iScript.setInTutorial(true);
        if (!tutorialStart)
        {
            //player.
            //
            vPlayer = GetComponentInChildren <VideoPlayer>();
            if (vPlayer == null)
            {
                Debug.Log("Could not find video player");
            }
            image = GetComponentInChildren <RawImage>();
            if (image == null)
            {
                Debug.Log("Could not find image");
            }
            Debug.Log((int)vPlayer.clip.width);
            Debug.Log((int)vPlayer.clip.height);

            rTexture = new RenderTexture((int)vPlayer.clip.width, (int)vPlayer.clip.height, 0);
            rTexture = new RenderTexture((int)vPlayer.clip.width, (int)vPlayer.clip.height, 0);

            vPlayer.targetTexture = rTexture;
            image.texture         = rTexture;

            Vector3 scale = image.transform.localScale;

            scale.y = vPlayer.clip.height / (float)vPlayer.clip.width * scale.y;

            image.transform.localScale = scale;
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        //NGUIDebug.Log("Text");
        iController = GetComponentInParent <InteractionControllerCopy>();
        cCollider   = GetComponent <CapsuleCollider>();
        if (iController == null)
        {
            Debug.Log("Could not find the iController script in parent");
        }

        if (cCollider == null)
        {
            Debug.Log("Could not find the cCollider ");
        }

        sRenderer = gameObject.GetComponent <SpriteRenderer>();
    }
    void Awake()
    {
        iScript = GetComponentInChildren <InteractionControllerCopy>();

        equippedLight    = 1;
        restrictMovement = false;
        tMovement        = traveller.GetComponent <travellerMovement>();
        if (tMovement == null)
        {
            Debug.Log("Could not find tscript");
        }

        abilityUIScript = lightAbility.GetComponent <abilityIconController>();
        if (abilityUIScript == null)
        {
            Debug.Log("Could not find abilityUIscript");
        }
    }