Пример #1
0
 void Start()
 {
     sr = GetComponent <SpriteRenderer>();
     a  = GetComponent <Animator>();
     rb = GetComponent <Rigidbody2D>();
     rc = GetComponent <RewindCore>();
     DistanceToTheGround = normCollider.bounds.extents.y + duckCollider.bounds.extents.y;
     DistanceToSide      = normCollider.bounds.extents.x;
 }
Пример #2
0
 void OnCollisionEnter2D(Collision2D other)
 {
     Debug.Log("COlide");
     if (other.gameObject.tag == "Player")
     {
         RewindCore rewindCore = other.gameObject.GetComponent <RewindCore>();
         if (rewindCore.getRewinding())
         {
             return;
         }
         else
         {
             rewindCore.startRewind();
         }
         Destroy(this.gameObject);
     }
 }
Пример #3
0
    void shoot()
    {
        RaycastHit2D ray;

        ray = Physics2D.Linecast(this.transform.position, player.transform.position);
        if (ray.collider != null)
        {
            RewindCore rewindCore = ray.collider.gameObject.GetComponent <RewindCore>();
            if (rewindCore.getRewinding())
            {
                return;
            }
            else
            {
                rewindCore.startRewind();
            }
        }
    }
Пример #4
0
 private void OnCollisionEnter2D(Collision2D other)
 {
     if (other.gameObject.tag == "Player")
     {
         RewindCore rewindCore = other.gameObject.GetComponent <RewindCore>();
         if (rewindCore.getRewinding())
         {
             return;
         }
         else
         {
             rewindCore.startRewind();
         }
     }
     else if (other.gameObject.tag == "Enemy")
     {
         return;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }