Exemplo n.º 1
0
    public void BreakFlower()
    {
        Fabric.EventManager.Instance.PostEvent("Sfx/Flower/Hit");
        FlowerSpawner.OneLessFlower();
        GetComponent <Animator>().enabled = false;
        naama.isKinematic = false;
        pressed           = true;

        int index = Random.Range(0, altFaces.Length);

        naama.GetComponent <Image>().sprite = altFaces[index];


        Vector2 dir = new Vector2(0, 1);

        for (int i = 0; i < lehdet.Length; i++)
        {
            lehdet[i].isKinematic = false;
            lehdet[i].AddForce(dir * force, ForceMode2D.Impulse);
            lehdet[i].AddTorque(Random.Range(-maxTorque, maxTorque), ForceMode2D.Impulse);

            dir = Quaternion.Euler(0, 0, -360 / lehdet.Length) * dir;
        }

        dir = new Vector2(0, 1);
        for (int i = 0; i < varret.Length; i++)
        {
            varret[i].isKinematic = false;
            varret[i].AddForce(dir * force, ForceMode2D.Impulse);
            varret[i].AddTorque(Random.Range(-maxTorque, maxTorque), ForceMode2D.Impulse);

            dir = Quaternion.Euler(0, 0, -360 / lehdet.Length) * dir;
        }
    }
Exemplo n.º 2
0
 IEnumerator RandomNotes()
 {
     while (FlowerSpawner.GetFlowersLeft() < 100)
     {
         synth.PlayNote(Random.Range(57, 78));
         yield return(new WaitForSeconds(Random.Range(0, 1f)));
     }
     yield return(new WaitForSeconds(1f));
 }
Exemplo n.º 3
0
 private void Start()
 {
     shopUI.enabled = false;
     flowerSpawner  = FindObjectOfType <FlowerSpawner>();
     pollenManager  = FindObjectOfType <PollenManager>();
     hive           = FindObjectOfType <Hive>();
     statManager    = FindObjectOfType <StatManager>();
     ResetPricesToDefault();
 }
Exemplo n.º 4
0
    public override void Enter()
    {
        FlowerSpawner flowers = GameObject.FindObjectOfType <FlowerSpawner>();

        bee.arriveEnabled = true;
        bee.arriveTarget  = new Vector3(
            Random.Range(-flowers.radius, flowers.radius)
            , 0.5f
            , Random.Range(-flowers.radius, flowers.radius)
            );
    }
Exemplo n.º 5
0
 private void Start()
 {
     shopUI.enabled    = false;
     flowerSpawner     = FindObjectOfType <FlowerSpawner>();
     pollenManager     = FindObjectOfType <PollenManager>();
     hive              = FindObjectOfType <Hive>();
     statManager       = FindObjectOfType <StatManager>();
     defenseBeeManager = FindObjectOfType <DefenseBeeManager>();
     SetFlowerText(flowerBuyPrice.ToString());
     SetBearRepelentText(bearRepelentPrice[bearRepelentsUsed].ToString());
     SetBeeText(beeGuardPrice[beeGuardAmount].ToString());
 }
Exemplo n.º 6
0
    void Update()
    {
        // End of song
        if (useRandomSong && !midiSequencer.isPlaying && !fc.GetRunning() && (FlowerSpawner.GetFlowersLeft() <= 0 || !spawnFlowers))
        {
            fc.EndScenarioStart();
        }

        if (GameObject.FindGameObjectsWithTag("Flower").Length == 0 && fc.GetEndDone())
        {
            SceneManager.LoadScene(0);
        }

        for (int i = 0; i < midiSamples.Length; i++)
        {
            if (stopNote[i])
            {
                stopNote[i] = false;
                if (keys[i] != null && !spawnFlowers)
                {
                    keys[i].GetComponent <Image>().color = Color.white;
                }
            }

            if (playNote[i])
            {
                playNote[i] = false;
                if (keys[i] != null && !spawnFlowers)
                {
                    // turns the note yellow
                    keys[i].GetComponent <Image>().color = Color.yellow;
                }

                if (spawnFlowers)
                {
                    spawner.SpawnFlower(i);
                }
            }
        }
    }
Exemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     playerBody = GetComponent<Rigidbody2D>();
     initialXPos = transform.position.x;
     initialTouchPosition = new Vector2(0, 0);
     cameraTransform = GameObject.FindGameObjectWithTag("MainCamera").transform;
     replayObject = GameObject.FindGameObjectWithTag("Respawn");
     replayMenu = replayObject.GetComponentInChildren<ReplayScript>();
     scoreBoard = GameObject.FindGameObjectWithTag("MainUI").GetComponent<ScoreUIScript>();
     trail = GetComponentInChildren<TrailRenderer>();
     indicatorSpawner = GetComponent<FlowerSpawner>();
 }
Exemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     GM      = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>();
     spawner = GameObject.FindGameObjectWithTag("CollectibleSpawner").GetComponent <FlowerSpawner>();
 }