コード例 #1
0
ファイル: EnemyAI.cs プロジェクト: vaginessa/RubberDucky-1
 void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "Player")
     {
         _owner.GetComponent <SphereCollider>().radius *= 2;
     }
 }
コード例 #2
0
    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++;
    }
コード例 #3
0
ファイル: State.cs プロジェクト: jei-W/duckFarm
 public State(Duck duck)
 {
     owner      = duck;
     ownerAgent = owner.GetComponent <NavMeshAgent>();
 }