/// <summary>
        /// This method is called when app is created
        /// </summary>
        protected override void OnCreate()
        {
            base.OnCreate();
            var app = new App();

            // To send event to UI
            pEvent = app;
            LoadApplication(app);
            PushPort.Register(pEvent);
        }
Ejemplo n.º 2
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        IPlatformEvent platformEvent = collision.GetComponent <IPlatformEvent>();

        if (platformEvent != null)
        {
            platformEvent.OnLeaveEvent();
        }

        if (groundLayer == (groundLayer | (1 << collision.gameObject.layer)))
        {
            controller.OnGround(false, collision);

            if (collision.transform == controller.transform.parent)
            {
                controller.transform.parent = null;
            }
        }
    }
Ejemplo n.º 3
0
    private void CollidingWith(Collider2D collision, bool firstFrame)
    {
        int layer = collision.gameObject.layer;

        if (playerRB.velocity.y > 0)
        {
            return;
        }

        if (groundLayer == (groundLayer | (1 << layer)))
        {
            controller.OnGround(true, collision);

            if (layer == platformLayer)
            {
                controller.transform.parent = collision.transform;

                Collider2D coll = collision.GetComponent <Collider2D>();
                if (firstFrame && coll)
                {
                    Vector2 position = controller.transform.position;
                    position.y = collision.transform.position.y + coll.bounds.extents.y + .5f;
                    if (Mathf.Abs(controller.transform.position.y - position.y) < .2f)
                    {
                        controller.transform.position = position;
                    }

                    IPlatformEvent platformEvent = collision.GetComponent <IPlatformEvent>();
                    if (platformEvent != null)
                    {
                        platformEvent.OnLandEvent();
                    }
                }
            }
        }
    }
Ejemplo n.º 4
0
 /// <summary>
 /// Used to register platform event.
 /// </summary>
 /// <param name="_pEvent">platform event</param>
 public static void EventRegister(IPlatformEvent _pEvent)
 {
     pEvent = _pEvent;
 }