Пример #1
0
    private void SpawnCow(Vector3 _position, float _speed, float _lifetime, float _followDistanceLimit)
    {
        GameObject   moo = Instantiate(TEMP_SoundDebugger, _position, Quaternion.identity);
        CowBehaviour cow = moo.GetComponent <CowBehaviour>();

        cow.SetCowStats(_speed, _lifetime, _followDistanceLimit);
        float _distance = Vector3.Distance(player.transform.position, _position);

        cow.anim.SetTrigger("Spawn");
    }
Пример #2
0
 private void OnCollisionEnter2D(Collision2D other)
 {
     if (state == State.BreedingIdle && other.gameObject.tag == "Cow")
     {
         CowBehaviour otherCow = other.gameObject.GetComponent <CowBehaviour>();
         if (otherCow.state == State.BreedingIdle)
         {
             otherSize      = otherCow.size;
             state          = State.Breeding;
             otherCow.state = State.PBreeding;
         }
     }
     else if (other.gameObject.tag == "Pen")
     {
         randomX = Random.Range(-1f, 1f);
         randomY = Random.Range(-1f, 1f);
     }
 }