예제 #1
0
        void LateUpdate()
        {
            if (!player)
            {
                return;
            }
            PlayerMovement pm = player.GetComponent <PlayerMovement>();

            //checking collision between player and all platforms
            foreach (AABB box in platforms)
            {
                if (player.OverlapCheck(box))
                {
                    pm.ApplyFix(player.FindFix(box));
                }
            }

            //colliding with any or all OverlapObjects
            foreach (AABB power in powerups)
            {
                if (player.OverlapCheck(power))
                {
                    OverlapObjects oo = power.GetComponent <OverlapObjects>();
                    if (oo)
                    {
                        oo.OnOverlap(pm);
                    }
                }
            }
        }
예제 #2
0
        void LateUpdate()
        {
            if (player.OverlapCheck(floor))
            {
                print("overlapping");

                Vector3 fix = player.FindFix(floor);

                player.GetComponent <PlayerMovement>().ApplyFix(fix);

                player.transform.position += fix;
            }
        }
예제 #3
0
        void LateUpdate()
        {
            PlayerMovement pm = player.GetComponent <PlayerMovement>();

            foreach (AABB box in platforms)
            {
                if (player.OverlapCheck(box))
                {
                    pm.ApplyFix(player.FindFix(box));
                }
            }
            foreach (AABB power in powerups)
            {
                if (player.OverlapCheck(power))
                {
                    SpringBlock sb = power.GetComponent <SpringBlock>();
                    if (sb)
                    {
                        sb.PlayerHit(pm);
                    }
                }
            }
        }