Example #1
0
    /// <summary>
    /// OnCollisionEnter2D event.
    /// </summary>
    /// <param name="collision">The collision parameters.</param>
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Player"))
        {
            audioSource.Play();
            velocity.x = rb2d.velocity.x;
            velocity.y = (rb2d.velocity.y / 2.0f) + (collision.collider.attachedRigidbody.velocity.y / 3.0f);

            if (Mathf.Abs(velocity.y) < smallestSpeedYAxis)
            {
                velocity.y = velocity.y > 0 ? smallestSpeedYAxis : -smallestSpeedYAxis;
            }

            rb2d.velocity = velocity;
        }

        else if (collision.gameObject.name == "RightWall")
        {
            OnPoint.Invoke(WallPosition.RightWall);
        }

        else if (collision.gameObject.name == "LeftWall")
        {
            OnPoint.Invoke(WallPosition.LeftWall);
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (eventSystem.IsPointerOverGameObject())
        {
            return;
        }
        var ray = mainCam.ScreenPointToRay(Input.mousePosition);

        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 50, groundLayer))
            {
                pointEvent.Invoke(hit.transform.position);
            }
        }
    }
Example #3
0
 private void MoveEnd(Card _card)
 {
     _card.InitActionCard();
     pointEvent?.Invoke(haveCardList);
     moveEnd?.Invoke();
 }