Example #1
0
 private void Awake()
 {
     _rigidbody = GetComponent <Rigidbody>();
     _sphereApplicationService =
         new SphereApplicationService(new SphereFactory(), new SphereRepository());
     _sphereId = new SphereId(Guid.NewGuid());
     _sphereApplicationService.Create(_sphereId);
 }
Example #2
0
        public Sphere MoveSphere(SphereId sphereId, Vector2 rawMoveDir)
        {
            var sphere = _sphereRepository.Find(sphereId);

            if (sphere == null)
            {
                throw new ArgumentNullException();
            }

            sphere.ChangeMoveDirection(new SphereMoveDirection(rawMoveDir));

            return(sphere);
        }
Example #3
0
 public Sphere Find(SphereId sphereId)
 {
     return(Db.ContainsKey(sphereId) ? Db[sphereId] : null);
 }
Example #4
0
 public Sphere Create(SphereId sphereId)
 {
     return(new Sphere(sphereId));
 }
Example #5
0
        public void Create(SphereId sphereId)
        {
            var sphere = _sphereFactory.Create(sphereId);

            _sphereRepository.Save(sphere);
        }