Exemple #1
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "Player")
     {
         _owner.GetComponent <SphereCollider>().radius *= 2;
     }
 }
    void SpawnDuck()
    {
        GameObject newDuck = PoolManager.getGameObjectFromPool(duckPrefab);

        newDuck.transform.parent = this.transform;
        Duck tempDuck = newDuck.GetComponent <Duck>();

        tempDuck.gameManager = gameManager;
        tempDuck.myParent    = this;
        tempDuck.maxSpeed    = Random.Range(4f, 5f);
        int randomBird = Random.Range(0, birdAnims.Length);

        tempDuck.myAnim = birdAnims[randomBird];
        AudioSource singing = tempDuck.GetComponent <AudioSource>();

        singing.clip = birdSinging[randomBird];
        singing.Play();
        if (randomSide)
        {
            tempDuck.startPosition = new Vector2(minX, Random.Range(minY, maxY));
            tempDuck.endPosition   = new Vector2(maxX, Random.Range(minY, maxY));
        }
        else
        {
            tempDuck.startPosition = new Vector2(minX, Random.Range(minY, maxY));
            tempDuck.endPosition   = new Vector2(maxX, Random.Range(minY, maxY));
        }
        tempDuckCount++;
    }
Exemple #3
0
 public State(Duck duck)
 {
     owner      = duck;
     ownerAgent = owner.GetComponent <NavMeshAgent>();
 }