// Use this for initialization
    void Start()
    {
        myLevelNumber = GetComponentInChildren <TextMesh> ();

        levelSelectMachineScript = GameObject.Find("LevelSelectMachine").GetComponent <levelSelectMachineController>();
        doorScript = GameObject.FindWithTag("Door").GetComponent <doorController>();
    }
    //public int currentSquarePos;

    // Use this for initialization
    void Start()
    {
        heavyColor   = new Color(1, 1, 1, 1);
        middleColor  = new Color(1, 1, 1, 1);
        lightColor   = new Color(1, 1, 1, 1);
        currentColor = new Color(1, 1, 1, 1);

        doorScript       = GameObject.FindWithTag("Door").GetComponent <doorController>();
        drumstick        = GameObject.Find("drumstick");
        mySpriteRenderer = GetComponent <SpriteRenderer>();
        me = gameObject;

        canSwitchCharacters = false;

        Vector3 pos = transform.position;

        //We start one to the left of the instruction square
        pos.x = -6f;
        pos.y = 1f;
        pos.z = -0.15f;
        //currentSquarePos = 0;
        transform.position = pos;

        drumstick.transform.localPosition = pos;
        drumstick.SetActive(false);
    }
    // Use this for initialization
    void Start()
    {
        doorScript = GameObject.FindWithTag("Door").GetComponent <doorController>();

        me = GetComponent <Camera>();
        //me.orthographic = false;
    }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        doorScript = GameObject.FindGameObjectWithTag("Door").GetComponent <doorController>();

        myTextMesh = GetComponent <TextMesh>();

        myColor.a = 0;
    }
Esempio n. 5
0
    /* I HAVE WRITTEN DOWN THE CURRENT MAP IN A SPREADSHEET
     * REMEMBER TO CHANGE IT WHENEVER YOU CHANGE THE CODE HERE PLEASE */


    // Use this for initialization
    void Start()
    {
        doorScript = GameObject.FindWithTag("Door").GetComponent <doorController>();

        for (int x = 0; x < Mathf.Sqrt(mapArray.Length); x++)
        {
            for (int n = 0; n < Mathf.Sqrt(mapArray.Length); n++)
            {
                mapArray[x, n] = 0;
            }
        }

        /*
         * //Levels 1-13 in straight line from [0, 9] to [14, 9]
         * for (int x = 0; x < 7; x++){
         *  mapArray[x + 1, 2] = x + 7;
         * }
         */

        /*
         * mapArray[6, 1] = 16;
         * mapArray[6, 0] = 17;
         *
         * mapArray[6, 3] = 15;
         * mapArray[7, 3] = 14;
         *
         * mapArray[0, 3] = 21;
         * mapArray[1, 3] = 1;
         * mapArray[2, 3] = 2;
         * mapArray[3, 3] = 3;
         *
         * mapArray[1, 4] = 6;
         * mapArray[2, 4] = 5;
         * mapArray[3, 4] = 4;
         */

        mapArray[1, 1] = 15;
        mapArray[1, 2] = 14;
        mapArray[1, 3] = 10;
        mapArray[1, 4] = 11;
        mapArray[1, 5] = 12;

        mapArray[2, 2] = 1;
        mapArray[2, 3] = 9;
        mapArray[2, 5] = 13;

        mapArray[3, 2] = 2;
        mapArray[3, 3] = 8;

        mapArray[4, 2] = 3;
        mapArray[4, 3] = 4;
        mapArray[4, 4] = 5;

        mapArray[5, 3] = 7;
        mapArray[5, 4] = 6;
    }
Esempio n. 6
0
    void Start()
    {
        Enemy  = GameObject.Find("troll2");
        Player = GameObject.Find("Player");

        thePlayer = FindObjectOfType <PlayerController> ();
        dControl  = thePlayer.GetComponent <doorController> ();

        EHMan = gameObject.GetComponent <EnemyHealthManager> ();
    }
    // Use this for initialization
    void Start()
    {
        doorScript = GameObject.FindWithTag("Door").GetComponent <doorController>();

        mySpriteRenderer      = GetComponent <SpriteRenderer>();
        patternSpriteRenderer = myPattern.GetComponent <SpriteRenderer>();

        dontDestroyUs = true;

        reset();
    }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        myAudioSource      = GetComponent <AudioSource>();
        myAudioSource.clip = mySound;
        mySpriteRenderer   = GetComponent <SpriteRenderer>();

        doorScript = GameObject.FindWithTag("Door").GetComponent <doorController>();
        youScript  = GameObject.FindWithTag("Player").GetComponent <youController>();

        mySpriteRenderer.color = doorScript.CurrentColorPalette[1];
    }
Esempio n. 9
0
    // Use this for initialization
    void Start()
    {
        //mySpriteRenderer = GetComponent<SpriteRenderer>();
        doorScript = GameObject.FindGameObjectWithTag("Door").GetComponent <doorController>();

        mySpriteRenderer = GetComponent <SpriteRenderer>();

        progressBarCover = GameObject.Find("Progress Bar Cover");
        progressBarCoverSpriteRenderer = progressBarCover.GetComponent <SpriteRenderer>();


        //Make the progress bar 8 long
        transform.localScale = new Vector3(8f, 0.4f, 1f);
    }
Esempio n. 10
0
    void testaColisaoRaycast()
    {
        RaycastHit2D hit = Physics2D.Raycast(Raypoint.position, new Vector2(horizontal, vertical), 0.11f, interacao);

        if (hit && !_TC.isDoor)
        {
            doorController temp = hit.transform.gameObject.GetComponent <doorController>();
            if (temp.doorSpecialEvent)
            {
                if (temp.monsters.Count == 0)
                {
                    _TC.isDoor = true;
                    _TC.startFade(temp);
                }
            }
            else if (!temp.doorLocked)
            {
                _TC.isDoor      = true;
                temp.doorClosed = false;
                temp.atualizaSprite();
                _TC.startFade(temp);
            }
            else
            {
                if (temp.idKey == 0 && doorKeys.Count > 0)
                {
                    _TC.isDoor      = true;
                    temp.doorClosed = false;
                    temp.doorLocked = false;
                    temp.atualizaSprite();
                    _TC.startFade(temp);
                }
                else
                {
                    if (doorKeys.Exists(element => element == temp.idKey))
                    {
                        _TC.isDoor      = true;
                        temp.doorClosed = false;
                        temp.doorLocked = false;
                        temp.atualizaSprite();
                        _TC.startFade(temp);
                    }
                }
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        myAudioSource      = GetComponent <AudioSource>();
        myAudioSource.clip = mySound;
        mySpriteRenderer   = GetComponent <SpriteRenderer>();
        myTextMesh         = GetComponentInChildren <TextMesh>();

        doorScript     = GameObject.FindWithTag("Door").GetComponent <doorController>();
        youScript      = GameObject.FindWithTag("Player").GetComponent <youController>();
        backdropScript = GameObject.Find("backdrop").GetComponent <backdropController>();

        int myDisplayNumber = myNumber + 1;

        myTextMesh.text = myDisplayNumber + "";

        squareNumberController myNumberDisplayController = myNumberDisplay.GetComponent <squareNumberController>();

        myNumberDisplayController.mySpriteRenderer.sprite = numbers[myNumber];
    }
    private void OnTriggerExit2D(Collider2D other)
    {
        if (other.tag == "Tornado")
        {
            canTornado = true;
            anim.SetBool("inTornado", false);
        }

        if (other.CompareTag("Door"))
        {
            currentDoor = null;
        }

        if (other.CompareTag("ResetDamaging"))
        {
            graceFrames = maxGraceFrames;
        }

        if (other.CompareTag("Water"))
        {
            steps.isSubmerged = false;
        }
    }
Esempio n. 13
0
    // Use this for initialization
    void Start()
    {
        Vector3 pos = transform.position;

        pos.x = 0.5f;
        pos.y = 1f;
        pos.z = 20f;

        transform.position = pos;

        Quaternion rot = transform.rotation;

        rotX = -45f;
        rotY = 45f;
        rotZ = 0f;

        rot = Quaternion.Euler(rotX, rotY, rotZ);

        transform.rotation = rot;

        doorScript = GameObject.FindWithTag("Door").GetComponent <doorController>();

        dontDestroyUs = true;
    }
 void Start()
 {
     thePlayer = FindObjectOfType <PlayerController> ();
     dControl  = thePlayer.GetComponent <doorController> ();
 }
 public void startFade(doorController portaS)     //passa como parâmetro o script da porta
 {
     door = portaS;
     animator.SetTrigger("FadeOut");
 }
Esempio n. 16
0
 // Use this for initialization
 void Start()
 {
     doorScript = GameObject.FindWithTag("Door").GetComponent <doorController>();
 }
Esempio n. 17
0
    // Update is called once per frame
    void Update()
    {
        if (CollisionFlag == true)
        {
            Balloon.SetActive(true);
            if (Input.GetKeyDown(KeyCode.C))
            {
                if (SwitchFlag == true)
                {
                    SwitchController Switch = obj.gameObject.GetComponent <SwitchController> ();
                    Switch.TurnSwitch();
                }
                else if (RockFlag == true)
                {
                    obj.gameObject.SetActive(false);
                }
                else if (Switch_GarekiFlag == true)
                {
                    SwitchController Switch = obj.gameObject.GetComponent <SwitchController>();
                    Switch.TurnSwitch();
                    obj.SetActive(false);
                }
                else if (BridgeFlag == true)
                {
                    BridgeController Bridge = obj.gameObject.GetComponent <BridgeController>();
                    Bridge.BridgeAction();
                }
                else if (PCFlag == true)
                {
                    if (PC.player == PlayerControler.playerType.Ed)
                    {
                        PC.player = PlayerControler.playerType.Dola;
                    }
                    else
                    {
                        PC.player = PlayerControler.playerType.Ed;
                    }
                }
                else if (doorFlag == true)
                {
                    doorController dc = obj.gameObject.GetComponent <doorController>();
                    dc.Moving();
                }
                else if (waterFlag == true)
                {
                    waterType++;
                    waterType %= 4;
                    switch (waterType)
                    {
                    case 0:
                        water.Event = WaterController.eventType.BtoA;
                        break;

                    case 1:
                        water.Event = WaterController.eventType.AtoB;
                        break;

                    case 2:
                        water.Event = WaterController.eventType.BtoC;
                        break;

                    case 3:
                        water.Event = WaterController.eventType.CtoB;
                        break;
                    }
                    water.EventFlag = true;
                }
                else if (keyFlag == true)
                {
                    if (KC.open == true)
                    {
                        KC.gateClose();
                    }
                    else
                    {
                        KC.gateOpen();
                    }
                }
            }
        }
        else
        {
            Balloon.SetActive(false);
        }
    }
    private void OnTriggerEnter2D(Collider2D other)
    {
        List <Collider2D> hitters = new List <Collider2D>();

        other.GetContacts(hitters);

        //Because the hitboxes appear as children, we have to filter AllyHitboxes out
        //Otherwise you could get hurt by whacking brambles or something
        //We can probably use this to implement hitlag when hurting things..
        foreach (Collider2D h in hitters)
        {
            if (h.tag == "AllyHitbox")
            {
                continue;
            }

            //if (other.transform.tag == "ResetDamaging" && !invulnerable)
            //{
            //    if (graceFrames > 0)
            //    {
            //        graceFrames--;
            //    }
            //    else
            //    {
            //        resetPosition = true;
            //    }
            //}
            if (intangibleStates.Contains(state))
            {
                return;
            }

            //if (other.gameObject.layer == LayerMask.NameToLayer("Danger") && !invulnerable)
            //{
            //    if (other.CompareTag("ResetDamaging") && graceFrames > 0) return;
            //    startBonk(1, resetPosition);
            //    return;
            //}

            if (other.tag == "Tornado" && canTornado)
            {
                resetAnimator();
                SoundManager.Instance.playClip("LevelObjects/EnterTornado");
                canTornado     = false;
                state          = State.Tornado;
                currentTornado = other.transform;
                Deformer nadoDeformer = other.GetComponent <Deformer>();
                if (nadoDeformer)
                {
                    nadoDeformer.startDeform(new Vector3(1.75f, .75f, 1.0f), 0.1f);
                }
            }

            if (other.CompareTag("Door"))
            {
                if (other.GetComponent <doorController>().enterable)
                {
                    currentDoor = other.GetComponent <doorController>();
                }
            }


            if (other.tag == "Follower")
            {
                followController other_fc = other.GetComponent <followController>();
                if (!other_fc.canCollect)
                {
                    return;
                }

                int numFollowers = 0;
                other_fc.following            = getFollower(GetComponent <followController>());
                other_fc.following.followedBy = other_fc;
                other_fc.canCollect           = false;

                followController getFollower(followController fc)
                {
                    if (!fc.followedBy)
                    {
                        return(fc);
                    }
                    else
                    {
                        numFollowers++;
                        return(getFollower(fc.followedBy));
                    }
                }

                SoundManager.Instance.playClip("Collectibles/starShard", numFollowers);
            }

            if (other.CompareTag("BroomCollectible") && state == State.Broom && hanger.childCount == 0)
            {
                other.transform.parent   = hanger;
                other.transform.position = hanger.position - Vector3.up * 0.15f;
                other.SendMessage("BroomPickUp");
            }

            if (other.CompareTag("Water"))
            {
                steps.isSubmerged = true;
            }
        }
    }
Esempio n. 19
0
    // Use this for initialization
    void Start()
    {
        /*
         * //play background music at half volume, looped
         * myAudioSource = GetComponent<AudioSource>();
         * myAudioSource.clip = backgroundMusic;
         * myAudioSource.loop = true;
         * myAudioSource.volume = 0.15f;
         *
         * //Don't play just yet
         * myAudioSource.Play();
         */

        AudioSource[] audioSources = GetComponents <AudioSource>();

        //play background music at half volume, looped
        backgroundBassSource        = audioSources[0];
        backgroundBassSource.clip   = backgroundBass;
        backgroundBassSource.loop   = true;
        backgroundBassSource.volume = 0f;

        backgroundBassDrumSource        = audioSources[1];
        backgroundBassDrumSource.clip   = backgroundBassDrum;
        backgroundBassDrumSource.loop   = true;
        backgroundBassDrumSource.volume = 00f;

        backgroundClickSource        = audioSources[2];
        backgroundClickSource.clip   = backgroundClick;
        backgroundClickSource.loop   = true;
        backgroundClickSource.volume = 0f;

        backgroundSnareSource        = audioSources[3];
        backgroundSnareSource.clip   = backgroundSnare;
        backgroundSnareSource.loop   = true;
        backgroundSnareSource.volume = 0f;

        backgroundMelodySource        = audioSources[4];
        backgroundMelodySource.clip   = backgroundMelody;
        backgroundMelodySource.loop   = true;
        backgroundMelodySource.volume = 0f;

        backgroundBassSource.Play();
        backgroundSnareSource.Play();
        backgroundBassDrumSource.Play();
        backgroundClickSource.Play();
        backgroundMelodySource.Play();


        backgroundBassSource.volume = bassVolume;

        /*
         * backgroundBassSource.volume = bassVolume;
         * backgroundSnareSource.volume = snareVolume;
         * backgroundClickSource.volume = clickVolume;
         * backgroundBassDrumSource.volume = bassDrumVolume;
         * backgroundMelodySource.volume = melodyVolume;
         */

        //Get door script
        doorScript = GameObject.FindWithTag("Door").GetComponent <doorController>();

        backgroundObjectScript       = backgroundObject1.GetComponent <backgroundObject1Controller>();
        backgroundObjectSquareScript = backgroundSquare.GetComponent <backgroundObject1Controller>();
        backgroundCircleScript       = backgroundCircle.GetComponent <backgroundObject1Controller>();


        spawn(6, 8, 8, true, true, false);
    }
Esempio n. 20
0
    // Use this for initialization
    void Start()
    {
        mySpriteRenderer = GetComponent <SpriteRenderer>();

        doorScript = GameObject.FindWithTag("Door").GetComponent <doorController>();
    }
    // Use this for initialization
    void Start()
    {
        myAudioSource    = GetComponent <AudioSource>();
        mySpriteRenderer = GetComponent <SpriteRenderer>();
        myTextMesh       = GetComponentInChildren <TextMesh>();

        doorScript = GameObject.FindWithTag("Door").GetComponent <doorController>();

        openDoorColor   = doorScript.CurrentColorPalette[2];
        closedDoorColor = doorScript.CurrentColorPalette[3];

        mySolutionCompleted = false;
        doorOpenPlayed      = false;
        myAudioSource.clip  = doorOpen;

        //we do this up here so the doors don't flash when we change levels
        //(this became a problem when we moved the doors to the edge of the screen)
        if (readyForLevelChange == true)
        {
            mySpriteRenderer.color = openDoorColor;
        }


        Vector3 pos  = transform.position;
        Vector3 size = transform.localScale;

        //Move us to the correct location
        //Move us to the correct location
        if (myDirection == "RIGHT")
        {
            pos  = new Vector3(7.15f, 1f, 0f);
            size = new Vector3(1f, 3f, 1f);

            myTextMesh.transform.localScale = new Vector3(1f, 0.33f, 1f);
            myOutline.transform.localScale  = new Vector3(1.1f, 1.03f, 1f);
        }
        else if (myDirection == "LEFT")
        {
            pos  = new Vector3(-6.16f, 1f, 0f);
            size = new Vector3(1f, 3f, 1f);

            myTextMesh.transform.localScale = new Vector3(1f, 0.33f, 1f);
            myOutline.transform.localScale  = new Vector3(1.1f, 1.03f, 1f);
        }
        else if (myDirection == "UP")
        {
            pos  = new Vector3(1f, 6f, 0f);
            size = new Vector3(3f, 1f, 1f);

            myTextMesh.transform.localScale = new Vector3(0.33f, 1f, 1f);
            myOutline.transform.localScale  = new Vector3(1.03f, 1.1f, 1f);
        }
        else if (myDirection == "DOWN")
        {
            pos  = new Vector3(1f, -4f, 0f);
            size = new Vector3(3f, 1f, 1f);

            myTextMesh.transform.localScale = new Vector3(0.33f, 1f, 1f);
            myOutline.transform.localScale  = new Vector3(1.03f, 1.1f, 1f);
        }

        transform.position   = pos;
        transform.localScale = size;
        //END NEW CODE
    }