Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     coroutine = WaitAndUpdate(1.0f);
     StartCoroutine(coroutine);
     gotoWaypointScript  = objVulture.GetComponent <goToWaypoint>();
     swipemovementScript = Camera.main.gameObject.GetComponent <SwipeMovement>();
 }
 void Start()
 {
     rdmobj          = GameObject.Find("RdmGen").GetComponent <RdmObjGen>();
     boostLane       = GameObject.Find("BoostLane");
     healthbarSlider = GameObject.Find("healthSlider").GetComponent <Slider>();
     boostbarSlider  = GameObject.Find("boostSlider").GetComponent <Slider>();
     ui        = GameObject.Find("UI");
     maincam   = GameObject.Find("Main Camera");
     cam       = Camera.main;
     btnPause  = GameObject.Find("Pause");
     goPanel   = GameObject.Find("goPanel");
     gameover  = goPanel.GetComponent <Animator>();
     player    = GameObject.FindGameObjectWithTag("Player");
     scoring   = GameObject.Find("subScoreCounter").GetComponent <scoreCounter>();
     pDescend  = player.gameObject.GetComponent <camdescend>();
     anim      = GameObject.FindGameObjectWithTag("character").GetComponent <Animation>();
     btnShield = GameObject.Find("btnShield").GetComponent <Button>();
     btnAttack = GameObject.Find("btnAttack").GetComponent <Button>();
     btnBoost  = GameObject.Find("btnBoost").GetComponent <Button>();
     PlayerPrefs.DeleteKey("tempGoldCoins");
     colCoins          = GameObject.Find("txtCc").GetComponent <Text>();
     character         = GameObject.FindGameObjectWithTag("character");
     lvlUpScript       = GameObject.Find("subScoreCounter").GetComponent <levelUp>();
     swipeScript       = maincam.gameObject.GetComponent <SwipeMovement>();
     txtExpReq         = GameObject.Find("txtExpReq").GetComponent <Text>();
     expSlider         = GameObject.Find("expSlider").GetComponent <Slider>();
     txtExpCur         = GameObject.Find("txtExpCur").GetComponent <Text>();
     rewardedAdsScript = GameObject.Find("simpleAd").GetComponent <rewardedAds>();
     uigoldScript      = GameObject.Find("txtuigold").GetComponent <uigoldUpdater>();
     pauseScript       = GameObject.Find("onPause").GetComponent <pauseScale>();
     uigoldScript.updateGoldCoin();
 }
Beispiel #3
0
    public void SetData(SwipeControls controls)
    {
        SwipeMovement swipeData = new SwipeMovement
        {
            StartPos      = startPosition,
            endPos        = endPosition,
            swipeControls = controls
        };

        data?.Invoke(swipeData);
    }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        maincam     = Camera.main.gameObject;
        ShieldLane  = GameObject.Find("ShieldLane");
        btnBoost    = GameObject.Find("btnBoost").GetComponent <Button>();
        btnAttack   = GameObject.Find("btnAttack").GetComponent <Button>();
        btnShield   = GameObject.Find("btnShield").GetComponent <Button>();
        btnPause    = GameObject.Find("Pause");
        swipeScript = maincam.GetComponent <SwipeMovement>();

        if (PlayerPrefs.HasKey("shieldSkillLvl"))
        {
            shieldSkillLvl = PlayerPrefs.GetInt("shieldSkillLvl");
        }
        else
        {
            shieldSkillLvl = 0;
        }

        coroutine = WaitAndUpdate(1.0f);
        StartCoroutine(coroutine);
    }
    // Use this for initialization
    void Start()
    {
        scoreCounter = GameObject.Find("subScoreCounter").GetComponent <scoreCounter>();
        PlayerPrefs.SetInt("boost3timesAch", 0);
        boostLane          = GameObject.Find("BoostLane");
        btnShield          = GameObject.Find("btnShield").GetComponent <Button>();
        btnAttack          = GameObject.Find("btnAttack").GetComponent <Button>();
        btnBoost           = GameObject.Find("btnBoost").GetComponent <Button>();
        btnPause           = GameObject.Find("Pause");
        maincam            = GameObject.Find("Main Camera");
        swipeScript        = maincam.gameObject.GetComponent <SwipeMovement>();
        boostPropScript    = GameObject.FindGameObjectWithTag("Player").GetComponent <boostProp>();
        cDownAttack        = GameObject.Find("cooldownAttack").GetComponent <cooldownAttack>();
        cDownShield        = GameObject.Find("cooldownShield").GetComponent <cooldownShield>();
        pauseScript        = GameObject.Find("onPause").GetComponent <pauseScale>();
        achPowerTripScript = GameObject.Find("btnBoost").GetComponent <achPowerTripper>();

        if (PlayerPrefs.HasKey("boostSkillLvl"))
        {
            boostSkillLvl = PlayerPrefs.GetInt("boostSkillLvl");
        }
        else
        {
            boostSkillLvl = 0;
        }

        if (boostbarSlider.value <= 0f && boostSkillLvl >= 1)
        {
            if (!isRunning)
            {
                regenBoost();
            }
        }

        coroutine = WaitAndUpdate(1.0f);
        StartCoroutine(coroutine);
    }
    void Unboost()
    {
        swipeScript                = maincam.gameObject.GetComponent <SwipeMovement>();
        swipeScript.currentLane    = "Lane2";
        swipeScript.targetPosition = swipeScript.target2.transform.position;

        charCollider         = GameObject.FindGameObjectWithTag("character").GetComponent <BoxCollider>();
        charCollider.enabled = true;
        sprPlayerShield      = GameObject.Find("sprite_playerShield");
        SpriteRenderer ren = sprPlayerShield.GetComponent <SpriteRenderer>();

        if (ren.enabled)
        {
            shieldCollider         = GameObject.Find("playerShield").GetComponent <BoxCollider>();
            shieldCollider.enabled = true;
        }


        Time.timeScale = 1f;
        //destroy all obstacles
        GameObject[] obs = GameObject.FindGameObjectsWithTag("Obstacles");
        sfxExplosion = GameObject.Find("sfxDestroyedByAttack").GetComponent <AudioSource>();
        explosion    = (GameObject)Resources.Load("Visuals/attackExplosion", typeof(GameObject));

        foreach (GameObject ob in obs)
        {
            Destroy(ob);
            sfxExplosion.Play();
            Instantiate(explosion, gameObject.transform.position, gameObject.transform.rotation);
        }

        //destroy collectiblecaps
        GameObject[] obscap = GameObject.FindGameObjectsWithTag("CollectiblesCap");
        foreach (GameObject obcap in obscap)
        {
            Destroy(obcap);
        }

        //destroy collectibleboost
        GameObject[] obsboost = GameObject.FindGameObjectsWithTag("CollectiblesBoost");
        foreach (GameObject obboost in obsboost)
        {
            Destroy(obboost);
        }

        //enable buttons
        btnPause.GetComponent <Button>().interactable = true;
        btnBoost.GetComponent <Button>().enabled      = true;
        btnShield.GetComponent <Button>().enabled     = true;
        btnAttack.GetComponent <Button>().enabled     = true;
        hudAnim = GameObject.Find("hud").GetComponent <Animator>();
        hudAnim.SetBool("isBoosting", false);

        //change button color

        /*  sprBoost = Resources.Load<Sprite>("Sprites/UI/btnBoost");
        *  sprShield = Resources.Load<Sprite>("Sprites/UI/btnShield");
        *  sprAttack = Resources.Load<Sprite>("Sprites/UI/btnAttack");*/

        /*   btnBoost.GetComponent<Image>().sprite = sprBoost;
         * btnShield.GetComponent<Image>().sprite = sprShield;
         * btnAttack.GetComponent<Image>().sprite = sprAttack;*/

        if (PlayerPrefs.GetString("chosenChar") == "Shopper_girl")
        {
            //turnOffTornados
            objBoostTornadoL = GameObject.Find("boostTornadoL");
            objBoostTornadoR = GameObject.Find("boostTornadoR");
            objBoostTornadoL.GetComponent <SpriteRenderer>().enabled = false;
            objBoostTornadoR.GetComponent <SpriteRenderer>().enabled = false;

            anim.CrossFade("shopper_idle_anim_root");
        }
        else if (PlayerPrefs.GetString("chosenChar") == "Fireman")
        {
            boostProps.SetActive(false);
            boostPropScript.objIdleProp.SetActive(true);

            anim.CrossFade("gary_idle_anim");
        }

        //stop boost music
        GameObject objboostMusic = GameObject.Find("btnBoost");

        boostMusicScript = objboostMusic.GetComponent <boostMusic>();
        boostMusicScript.stopBoostMusic();

        if (boostbarSlider.value <= 0f && boostSkillLvl >= 1)
        {
            if (!isRunning)
            {
                regenBoost();
            }
        }

        //resume cooldowns
        cDownAttack.isBoosting = false;
        cDownShield.isBoosting = false;
        pauseScript.isBoosting = false;
    }
 void Start()
 {
     cam         = Camera.main;
     swipeScript = cam.GetComponent <SwipeMovement>();
 }