Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace EAE_Assignment_8
- {
- class Bounds : Component
- {
- int bounds;
- public Bounds(int bounds)
- {
- this.bounds = bounds;
- }
- public override void Update()
- {
- if (Container.Position.x > bounds )
- {
- Container.Position.x = bounds;
- }
- else if(Container.Position.x<0)
- {
- Container.Position.x = 0;
- }
- else
- {
- Container.Position.x = Container.Position.x;
- }
- if (Container.Position.y > bounds)
- {
- Container.Position.y = bounds;
- }
- else if(Container.Position.y<0)
- {
- Container.Position.y = 0;
- }
- else
- {
- Container.Position.y = Container.Position.y;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement