Beispiel #1
0
 // Start is called before the first frame update
 void Start()
 {
     myAnimator    = GetComponent <Animator>();
     myRigidbody   = GetComponent <Rigidbody>();
     myBoxCollider = GetComponent <BoxCollider>();
     player        = GameObject.Find("PJohns");
     pigeonstate   = pigeonState.notcaptured;
 }
Beispiel #2
0
 private void Return2Player()
 {
     target = player;
     myAnimator.SetBool("Flying", true);
     myRigidbody.velocity = new Vector3(0f, 0f, 0f);
     transform.position   = Vector3.MoveTowards(transform.position, playerArm.transform.position, pigeonSpeed * Time.deltaTime);
     if (Vector3.Distance(transform.position, playerArm.transform.position) <= .1f)
     {
         crosshair.GetComponent <Crosshair>().thingivehit = null;
         hotdogState = pigeonState.resetpigeon;
     }
 }
Beispiel #3
0
 private void ResetPigeon()
 {
     {
         gameObject.GetComponent <SpriteRenderer>().sortingOrder = 1;
         myAnimator.SetBool("PigeonListen", false);
         myAnimator.SetBool("Flying", false);
         myAnimator.SetBool("Jump", false);
         myAnimator.SetBool("Walk", false);
         freezePigeon           = false;
         myRigidbody.useGravity = true;
         resetpigeon            = false;
         hotdogState            = pigeonState.followplayer;
     }
 }
Beispiel #4
0
 // If Pigeon is touching ground, turn flying off & remove velocity
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Ground")
     {
         isTouchingGround     = true;
         myRigidbody.velocity = new Vector3(0f, 0f, 0f);
         myAnimator.SetBool("Flying", false);
         myAnimator.SetBool("Walk", true);
     }
     if (other.tag == "Carryable")
     {
         transform.localScale = new Vector3((transform.localScale.x * -1f), transform.localScale.y, transform.localScale.z);
         hotdogState          = pigeonState.returntoplayer;
     }
 }
Beispiel #5
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Ground")
     {
         isTouchingGround     = true;
         myRigidbody.velocity = new Vector3(0f, 0f, 0f);
         myAnimator.SetBool("Flying", false);
     }
     else if (other.tag == "Player" && captured == false)
     {
         print("i've collided with PJOhns");
         player.GetComponent <Player>().pigeonbox.Add(this.gameObject);
         captured    = true;
         pigeonstate = pigeonState.followplayer;
     }
 }
Beispiel #6
0
 private void FollowCommand()
 {
     myAnimator.SetBool("Idle", false);
     myAnimator.SetBool("Walk", false);
     myAnimator.SetBool("Flying", true);
     myRigidbody.useGravity = false;
     transform.position     = Vector3.MoveTowards(transform.position, target.transform.position, pigeonSpeed * Time.deltaTime);
     if (Vector3.Distance(transform.position, target.transform.position) < 0.5f)
     {
         freezePigeon = true;
         targetObject.SendMessage("killHealth", 5);
         if (targetObject.GetComponent <ObjectHealth>().health <= 0)
         {
             hotdogState = Hotdog.pigeonState.followplayer;
             crosshair.GetComponent <Crosshair>().thingivehit     = null;
             crosshair.GetComponent <Crosshair>().ivehitsomething = false;
         }
     }
 }