Exemplo n.º 1
0
        public Motor(LocalAvatarEntity localAvatarEntity)
        {
            mLocalAvatarEntity = localAvatarEntity;
            GameObject gameObjectToMotorize = localAvatarEntity.UnityGameObject;

            if (gameObjectToMotorize == null)
            {
                throw new ArgumentNullException("gameObjectToMotorize");
            }

            mRigidBody = gameObjectToMotorize.GetComponent(typeof(Rigidbody)) as Rigidbody;
            if (mRigidBody == null)
            {
                mRigidBody = gameObjectToMotorize.AddComponent(typeof(Rigidbody)) as Rigidbody;
            }

            mScheduler = GameFacade.Instance.RetrieveMediator <SchedulerMediator>().Scheduler;

            mCollisionReceipt = CollisionUtility.ListenForCollisions(mRigidBody, StopMovingWhenHitGround);
        }