Esempio n. 1
0
 void Update()
 {
     if (GManager == null)
     {
         GManager = FindObjectOfType <OverallGameManager> ();
     }
 }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        if (gManager == null)
        {
            gManager = FindObjectOfType <OverallGameManager> ();
        }
        if (gManager.points > 0 && gManager.points < 33)
        {
            originalText = "You saved: " + gManager.points.ToString() + " out of 33 people% and finished before running out of power.%Congratulations!";
        }
        if (gManager.points == 0)
        {
            originalText = "You saved no one and%finished before running out of power.%At least you survived.%Alone.%Forever.";
        }
        if (gManager.points >= 33)
        {
            originalText = "You managed to save everyone%and even had some power left!%Congratulations!";
        }
        string newText = originalText.Replace("%", "\n");

        actualText.text = newText;
        cmonTimer      += Time.deltaTime;
        if (Input.anyKeyDown && cmonTimer >= 1f)
        {
            gManager.Restart();
        }
    }
Esempio n. 3
0
 void Start()
 {
     posOc    = new bool[10, 5];
     goshujin = FindObjectOfType <OverallGameManager> ();
     //currentStage = goshujin.stage;
     curThreatDebug = currentStage;
     Debug.Log("is even running?");
 }
Esempio n. 4
0
 // Update is called once per frame
 void Update()
 {
     if (GManager == null)
     {
         GManager = FindObjectOfType <OverallGameManager> ();
     }
     actualText.text = ("Saved: " + GManager.points.ToString());
 }
Esempio n. 5
0
 private void Start()
 {
     bm          = FindObjectOfType <BoardManager>();
     gameManager = FindObjectOfType <OverallGameManager>();
     if (bm.checkTutorial())
     {
         spawnTutorialPiece(0);
     }
 }
Esempio n. 6
0
    // private int tutorialStep = 0;

    // private bool canAct(){
    //     return tutorialStepCanAct[tutorialStep];
    // }

    private void Start()
    {
        gameManager = FindObjectOfType <OverallGameManager>();
        groupAdder  = FindObjectOfType <GroupAdder>();
        // curNodeGroup = groupAdder.getTutorialCount();
        tutorialText.GetComponent <Renderer>().sortingLayerName = "GameOver";
        curStep = steps[0];
        StartCoroutine(waitForProcede());
    }
    // Update is called once per frame
    void LateUpdate()
    {
        if (GManager == null)
        {
            GManager = FindObjectOfType <OverallGameManager> ();
        }

        actSprite.sprite = health[GManager.fuel];
    }
Esempio n. 8
0
 // Use this for initialization
 void Start()
 {
     body     = GetComponent <Rigidbody2D> ();
     anim     = GetComponentInChildren <Animator> ();
     sEffects = GetComponent <AudioSource> ();
     sEffects.PlayOneShot(newStage);
     GManager               = FindObjectOfType <OverallGameManager> ();
     playerRender           = GetComponent <SpriteRenderer> ();
     tempoInvencivelCounter = tempoInvencivel;
 }
Esempio n. 9
0
 private void Awake()
 {
     if (ogm == null)
     {
         DontDestroyOnLoad(gameObject);
         ogm = this;
     }
     else if (ogm != this)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 10
0
 void Awake()
 {
     if (gameManager == null)
     {
         DontDestroyOnLoad(gameObject);
         gameManager = this;
     }
     else if (gameManager != this)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 11
0
    //public GameObject trees;
    // Use this for initialization
    void Start()
    {
        rgdBody     = GetComponentInChildren <Rigidbody>();
        gorakutile  = GetComponentInChildren <Identifier>().gameObject;
        gameManager = GameObject.Find("GameController");

        gorakutile.SetActive(false);
        rend = GetComponentInChildren <Renderer>();
        // rgdBody.useGravity = false;
        rgdBody.isKinematic = false;
        obs            = GetComponent <NavMeshObstacle>();
        obs.enabled    = false;
        dataController = gameManager.GetComponent <MazeDataController>();
        ogm            = gameManager.GetComponent <OverallGameManager>();
    }
Esempio n. 12
0
    void Update()
    {
        if (!rescue)
        {
            transform.Rotate(new Vector3(0, 0, turnSpeed * Time.deltaTime * turnDirection));
        }

        if (GManager == null)
        {
            GManager = FindObjectOfType <OverallGameManager> ();
            if (GManager == null)
            {
                GameObject whyTho;
                whyTho   = (Instantiate(godDebug, transform.position, transform.rotation));
                GManager = FindObjectOfType <OverallGameManager> ();
            }
        }
    }
Esempio n. 13
0
    // Update is called once per frame
    void Update()
    {
        if (GManager == null)
        {
            GManager = FindObjectOfType <OverallGameManager> ();
        }
        originalText = "Dried out.%You saved " + GManager.points.ToString() + " people%before running out of power.%Press R to Restart";
        if (GManager.isAlive == true)
        {
            actualText.color = new Color(255, 255, 255, 0);
        }
        if (GManager.isAlive == false)
        {
            actualText.color = new Color(255, 255, 255, 255);
        }
        string newText = originalText.Replace("%", "\n");

        actualText.text = newText;
    }
Esempio n. 14
0
    void Awake()
    {
        gameManager = FindObjectOfType <OverallGameManager>();
        gameOverText.SetActive(false);

        highScore = PlayerPrefs.HasKey("highScore") ? PlayerPrefs.GetInt("highScore") : 0;

        score      = 0;
        comboScore = 0;
        nodes      = new NodeScript[getBoardSizeX(), getBoardSizeY()];
        for (int i = 0; i < getBoardSizeX(); i++)
        {
            for (int j = 0; j < getBoardSizeY(); j++)
            {
                Instantiate(initialSpace,
                            new Vector3(i - (getBoardSizeX() / 2),
                                        j - (getBoardSizeY() / 2),
                                        0), Quaternion.identity);
            }
        }
    }
Esempio n. 15
0
    // Update is called once per frame
    void Update()
    {
        transform.Rotate(new Vector3(0, 0, turnSpeed * Time.deltaTime * turnDirection));
        if (GManager == null)
        {
            GManager = FindObjectOfType <OverallGameManager> ();
        }
        if (dead)
        {
            deathTimer += Time.deltaTime;
            CircleCollider2D Bob = GetComponent <CircleCollider2D> ();
            Bob.isTrigger = true;
            anim.SetBool("Boom", true);


            if (deathTimer >= 0.3f)
            {
                Destroy(gameObject);
            }
        }
    }
 void Start()
 {
     GManager  = FindObjectOfType <OverallGameManager> ();
     actSprite = GetComponent <SpriteRenderer> ();
 }
Esempio n. 17
0
 // Use this for initialization
 void Awake()
 {
     agent = GetComponent <NavMeshAgent>();
     ogm   = gameManager.GetComponent <OverallGameManager>();
     ac    = GetComponentInChildren <AnimationController> ();
 }
Esempio n. 18
0
 void Start()
 {
     dataController = GetComponent <MazeDataController>();
     ogm            = GetComponent <OverallGameManager>();
     //StartNewRound ();
 }
Esempio n. 19
0
    /*void OnTriggerStay2D(Collider2D other)
     * {
     *      if (other.gameObject.layer == 8)
     *      {
     *              WallType orientation = other.GetComponent<WallType> ();
     *              if ((body.velocity.x > 0 && orientation.Type == 1) ||(body.velocity.x < 0 && orientation.Type == 2))
     *                      body.velocity = new Vector2 (0, body.velocity.y);
     *              if ((body.velocity.y > 0 && orientation.Type == 3) || (body.velocity.y < 0 && orientation.Type == 4))
     *                      body.velocity = new Vector2 (body.velocity.x,0);
     *      }
     * }
     */
    void Update()
    {
        if (GManager == null)
        {
            GManager = FindObjectOfType <OverallGameManager> ();
        }
        lastBoost += Time.deltaTime;
        if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
        {
            if (rotating > -1)
            {
                rotating -= Time.deltaTime * rotateSpeed;
            }
            else
            {
                rotating = -1;
            }
        }
        else if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
        {
            if (rotating < 1)
            {
                rotating += Time.deltaTime * rotateSpeed;
            }
            else
            {
                rotating = 1;
            }
        }
        else if (rotating != 0)
        {
            rotating = rotating / rotateSpeed;
            if (rotating < 0.01f && rotating > -0.01f)
            {
                rotating = 0;
            }
        }
        transform.Rotate(new Vector3(0, 0, (rotating * -turnspeed * Time.deltaTime) + (gravRotate * Time.deltaTime)));
        anim.SetFloat("Rotating", Mathf.Abs(rotating));
        //if (GManager == null)
        //	GManager = FindObjectOfType<OverallGameManager> ();
        speedcheckerx = body.velocity.x;
        speedcheckery = body.velocity.y;
        if (GManager.fuel <= 0 && body.velocity.x == 0 && body.velocity.y == 0)
        {
            GManager.isAlive = false;
        }
        if (body.velocity.y != 0 && isPulled == false)
        {
            body.AddForce(new Vector2(0, -body.velocity.y * checker));
        }
        if (body.velocity.x != 0 && isPulled == false)
        {
            body.AddForce(new Vector2(-body.velocity.x * checker, 0));
        }

        if (Input.GetKeyDown(KeyCode.Space) && GManager.fuel > 0)
        {
            body.AddForce(transform.up * Truster);
            GManager.fuel--;
            lastBoost = 0;
            sEffects.PlayOneShot(boom);
            anim.Play("AstronautPropel");
        }
        if (Input.GetKeyDown(KeyCode.Space) && GManager.fuel <= 0)
        {
            sEffects.PlayOneShot(poof);
            anim.Play("AstronautPooh");
        }

        /*if (Input.GetKey (KeyCode.RightArrow)) {
         *      transform.Rotate (new Vector3 (0, 0, -turnspeed));
         *      anim.Play ("AstronautRotate");
         * } else if (Input.GetKey (KeyCode.LeftArrow)) {
         *      transform.Rotate (new Vector3 (0, 0, turnspeed));
         *      anim.Play ("AstronautRotate");
         * } */


        //Colisão
        if (crash)
        {
            tempoInvencivelCounter -= Time.smoothDeltaTime;
            if (tempoInvencivelCounter > tempoInvencivel * 0.66f && tempoInvencivelCounter < tempoInvencivel)
            {
                playerRender.color = new Color(playerRender.color.r, playerRender.color.g, playerRender.color.b, 0.2f);
            }
            else if (tempoInvencivelCounter > tempoInvencivel * 0.33f)
            {
                playerRender.color = new Color(playerRender.color.r, playerRender.color.g, playerRender.color.b, 1f);
            }
            else if (tempoInvencivelCounter > 0f)
            {
                playerRender.color = new Color(playerRender.color.r, playerRender.color.g, playerRender.color.b, 0.2f);
            }
            else
            {
                playerRender.color     = new Color(playerRender.color.r, playerRender.color.g, playerRender.color.b, 1f);
                tempoInvencivelCounter = tempoInvencivel;
                crash = false;
            }
        }
    }
Esempio n. 20
0
 void Start()
 {
     ogm      = FindObjectOfType <OverallGameManager>();
     isActive = ogm.checkMute();
     updateSprite();
 }
Esempio n. 21
0
 void Start()
 {
     bm          = FindObjectOfType <BoardManager>();
     gameManager = FindObjectOfType <OverallGameManager>();
 }
Esempio n. 22
0
 private void Start()
 {
     overallManager = FindObjectOfType <OverallGameManager>();
 }