Пример #1
0
 public ParticleCollisionSolver(ComputeShader compute, VelocityService v, PositionService p, LifeService l, ICollisionDetection b)
 {
     _kernel     = compute.FindKernel(ShaderConst.KERNEL_SOLVE_PARTICLE_COLLISION);
     _compute    = compute;
     _velocities = v;
     _positions  = p;
     _lifes      = l;
     _broadphase = b;
 }
 public ParticleCollisionSolver(ComputeShader compute, VelocityService v, PositionService p, LifeService l, ICollisionDetection b)
 {
     _kernel = compute.FindKernel(ShaderConst.KERNEL_SOLVE_PARTICLE_COLLISION);
     _compute = compute;
     _velocities = v;
     _positions = p;
     _lifes = l;
     _broadphase = b;
 }
Пример #3
0
 public PacManGame(
     IEventSink eventSink,
     IMapLoader <ITilemap> mapLoader,
     ICollisionDetection collisionDetection,
     ISpriteRenderer renderer)
 {
     _eventSink          = eventSink;
     _mapLoader          = mapLoader;
     _gameState          = new GameState(3);
     _collisionDetection = collisionDetection;
     _renderer           = renderer;
 }
Пример #4
0
        private void ProcessCommands(Constant.enumMessage[] commands)
        {
            foreach (IScript script in scriptList)
            {
                foreach (Constant.enumMessage c in commands)
                {
                    m_PostOffice.LockMessageType(c);
                    m_PostOffice.RemoveMessage(c, m_ModuleID, true);

                    switch (c)
                    {
                    case (Constant.enumMessage.INITIALISE):
                        script.Init();
                        break;

                    case (Constant.enumMessage.UPDATE):
                        script.Update();
                        break;

                    case (Constant.enumMessage.DRAW):
                        script.Draw();
                        break;

                    case (Constant.enumMessage.COLLISIONDETECTION):
                        ICollisionDetection collisionDection = script as ICollisionDetection;
                        if (collisionDection != null)
                        {
                            int[] gameObjIDArray = Array.ConvertAll((Methods.GetObjectArrayOf <String>(m_PostOffice.GetMessageObjects(m_ModuleID, Constant.enumMessage.COLLISIONDETECTIONDATA))), s => int.Parse(s));

                            if (gameObjIDArray.Count() > 0 && script.m_GameObject.m_GameObjectId != gameObjIDArray[0])
                            {
                                String[] gameObjeKeyArray = RequestGameObjectKeyByID(gameObjIDArray);
                                collisionDection.CollisionDetection(gameObjeKeyArray[1]);
                            }
                        }
                        break;

                    default:
                        break;
                    }
                    m_PostOffice.UnLockMessageType(c);
                }
            }
        }
 // Start is called before the first frame update
 void Start()
 {
     _collisions = GetComponent <CollisionDetection>();
 }