Пример #1
0
        public bool Raycast(Vector3 origin, Vector3 direction, out Uniject.RaycastHit hitinfo, float distance, int layerMask)
        {
            UnityEngine.RaycastHit unityHit = new UnityEngine.RaycastHit();
            bool result = UnityEngine.Physics.Raycast(origin, direction, out unityHit, distance, layerMask);

            if (result)
            {
                TestableGameObject    testable = null;
                UnityGameObjectBridge bridge   = unityHit.collider.gameObject.GetComponent <UnityGameObjectBridge>();
                if (null != bridge)
                {
                    testable = bridge.wrapping;
                }

                hitinfo = new RaycastHit(unityHit.point,
                                         unityHit.normal,
                                         unityHit.barycentricCoordinate,
                                         unityHit.distance,
                                         unityHit.triangleIndex,
                                         unityHit.textureCoord,
                                         unityHit.textureCoord2,
                                         unityHit.lightmapCoord,
                                         testable,
                                         unityHit.collider);
            }
            else
            {
                hitinfo = new RaycastHit();
            }

            return(result);
        }
Пример #2
0
 public TestableInput(TestableGameObject obj, IInput input,
                      Sphere sphere)
     : base(obj)
 {
     this.sphere = sphere;
     this.input = input;
 }
Пример #3
0
 public void UnRegisterGameobject(TestableGameObject obj)
 {
     if (!(objects.Contains(obj) || toAdd.Contains(obj))) {
         throw new ArgumentException("Removing non existent game object");
     }
     toRemove.Add(obj);
 }
Пример #4
0
 public void RegisterGameobject(TestableGameObject obj)
 {
     if (objects.Contains(obj) || toAdd.Contains(obj)) {
         throw new ArgumentException("Duplicate game object");
     }
     toAdd.Add(obj);
 }
Пример #5
0
 public UnityAudioListener(TestableGameObject parent, GameObject obj)
     : base(parent)
 {
     AudioListener listener = obj.GetComponent<AudioListener>();
     if (null == listener) {
         obj.AddComponent<AudioListener>();
     }
 }
Пример #6
0
 public void RegisterGameobject(TestableGameObject obj)
 {
     if (objects.Contains(obj) || toAdd.Contains(obj))
     {
         throw new ArgumentException("Duplicate game object");
     }
     toAdd.Add(obj);
 }
Пример #7
0
 public void UnRegisterGameobject(TestableGameObject obj)
 {
     if (!(objects.Contains(obj) || toAdd.Contains(obj)))
     {
         throw new ArgumentException("Removing non existent game object");
     }
     toRemove.Add(obj);
 }
Пример #8
0
        public UnityAudioListener(TestableGameObject parent, GameObject obj) : base(parent)
        {
            AudioListener listener = obj.GetComponent <AudioListener>();

            if (null == listener)
            {
                obj.AddComponent <AudioListener>();
            }
        }
Пример #9
0
 public Collision(Vector3 relativeVelocity,
                  ITransform transform,
                  TestableGameObject gameObject,
                  ContactPoint[] contacts) : this() {
     this.relativeVelocity = relativeVelocity;
     this.transform = transform;
     this.gameObject = gameObject;
     this.contacts = contacts;
 }
Пример #10
0
 public Sphere(TestableGameObject obj,
     IRigidBody body,
     ISphereCollider collider,
     [Resource("mesh/sphere")] TestableGameObject sphere)
 {
     this.obj = obj;
     this.collider = collider;
     this.body = body;
     sphere.transform.Parent = obj.transform;
 }
Пример #11
0
    public TestableExample(TestableGameObject parent,
                           IAudioSource source,
                           Sphere sphere,
                           [Resource("audio/beep")] AudioClip beep) : base(parent)
    {
        this.source = source;
        this.beep   = beep;

        this.Obj.transform.localScale = new Vector3(5, 5, 5);
    }
Пример #12
0
 public Sphere(TestableGameObject obj,
               IRigidBody body,
               ISphereCollider collider,
               [Resource("mesh/sphere")] TestableGameObject sphere)
 {
     this.obj                = obj;
     this.collider           = collider;
     this.body               = body;
     sphere.transform.Parent = obj.transform;
 }
Пример #13
0
    public TestableExample(TestableGameObject parent,
        IAudioSource source,
        Sphere sphere,
        [Resource("audio/beep")] AudioClip beep)
        : base(parent)
    {
        this.source = source;
        this.beep = beep;

        this.Obj.transform.localScale = new Vector3(5, 5, 5);
    }
Пример #14
0
    public TestableExample(TestableGameObject parent, ISphereCollider collider, IRigidBody body,
                           IResourceLoader loader) : base(parent)
    {
        this.collider = collider;
        this.body     = body;

        this.collider.radius = 5.0f;
        this.body.mass       = 4.0f;

        loader.instantiate("Sphere").transform.Parent = Obj.transform;
    }
Пример #15
0
 public BouncingLight(TestableGameObject obj,
                      Sphere sphere,
                      [Resource("physic/bouncy")] IPhysicMaterial material,
                      ILight light,
                      Random rand) : base(obj)
 {
     this.light = light;
     this.rand  = rand;
     sphere.collider.material = material;
     light.intensity          = 2.0f;
     light.range = 15;
 }
Пример #16
0
 public BouncingLight(TestableGameObject obj,
                      Sphere sphere,
                      [Resource("physic/bouncy")] IPhysicMaterial material,
                      ILight light,
                      Random rand)
     : base(obj)
 {
     this.light = light;
     this.rand = rand;
     sphere.collider.material = material;
     light.intensity = 2.0f;
     light.range = 15;
 }
Пример #17
0
 public ScanningLaser(TestableGameObject obj,
                      Box box,
                      [GameObjectBoundary] Sphere sphere,
                      IPhysics physics,
                      IRigidBody body,
                      ILayerMask layerMask) : base(obj)
 {
     this.physics                 = physics;
     this.sphere                  = sphere;
     body.useGravity              = false;
     sphere.collider.enabled      = false;
     box.Obj.transform.localScale = new UnityEngine.Vector3(10, 1, 1);
     sphere.body.isKinematic      = true;
     body.AddTorque(new UnityEngine.Vector3(0, 5, 0), UnityEngine.ForceMode.Impulse);
     mask = 1 << layerMask.NameToLayer("Default");
 }
Пример #18
0
    public Character(TestableGameObject obj,
                     IRigidBody body,
                     IBoxCollider collider
                     /*[Resource("Characters/char")] TestableGameObject character*/
                     ) : base(obj)
    {
        this.obj         = obj;
        this.collider    = collider;
        this.body        = body;
        body.isKinematic = true;
        TestableGameObject character = new UnityGameObject(GameManager.instance.Character);

        character.transform.Parent        = obj.transform;
        character.transform.LocalPosition = Vector3.zero;
        obj.transform.Position            = GameManager.instance.LevelController.StartTransform.position;
        GameManager.instance.CanRun       = true; //старт
    }
Пример #19
0
 public ScanningLaser(TestableGameObject obj,
                      Box box,
                      [GameObjectBoundary] Sphere sphere,
                      IPhysics physics,
                      IRigidBody body,
                      ILayerMask layerMask)
     : base(obj)
 {
     this.physics = physics;
     this.sphere = sphere;
     body.useGravity = false;
     sphere.collider.enabled = false;
     box.Obj.transform.localScale = new UnityEngine.Vector3(10, 1, 1);
     sphere.body.isKinematic = true;
     body.AddTorque(new UnityEngine.Vector3(0, 5, 0), UnityEngine.ForceMode.Impulse);
     mask = 1 << layerMask.NameToLayer("Default");
 }
Пример #20
0
 public RaycastHit(Vector3 point,
                   Vector3 normal,
                   Vector3 barycentricCoordinate,
                   float distance,
                   int triangleIndex,
                   Vector2 textureCoord,
                   Vector2 textureCoord2,
                   Vector2 lightmapCoord,
                   TestableGameObject hit,
                   Collider collider) : this() {
     this.point = point;
     this.normal = normal;
     this.barycentricCoordinate = barycentricCoordinate;
     this.distance = distance;
     this.triangleIndex = triangleIndex;
     this.textureCoord = textureCoord;
     this.textureCoord2 = textureCoord2;
     this.lightmapCoord = lightmapCoord;
     this.hit = hit;
     this.collider = collider;
 }
Пример #21
0
 public HasSingletonTime(TestableGameObject obj, ITime time)
     : base(obj)
 {
     injectedTime = time;
 }
Пример #22
0
 public HasSingletonInput(TestableGameObject obj, IInput input)
     : base(obj)
 {
     injectedInput = input;
 }
Пример #23
0
 public HasInjectedPrefab(TestableGameObject parent, [Resource("mesh/sphere")] TestableGameObject nested)
     : base(parent)
 {
     this.nested = nested;
     nested.transform.Parent = this.Obj.transform;
 }
Пример #24
0
 public TestableComponent(TestableGameObject obj)
 {
     this.enabled = true;
     this.obj = obj;
     obj.registerComponent(this);
 }
Пример #25
0
 public HasSingletonInput(TestableGameObject obj, IInput input) : base(obj)
 {
     injectedInput = input;
 }
Пример #26
0
	public Character( TestableGameObject parent, ITime time )
		: base( parent ) {
		this.time = time;
	}
Пример #27
0
 public TestableInput(TestableGameObject obj, IInput input,
                      Sphere sphere) : base(obj)
 {
     this.sphere = sphere;
     this.input  = input;
 }
Пример #28
0
 public FakeComponent(TestableGameObject obj) : base(obj)
 {
     this.obj = obj;
 }
Пример #29
0
 public FakeAudioSource(TestableGameObject obj) : base(obj)
 {
 }
Пример #30
0
 public FakeAudioSource(TestableGameObject obj)
     : base(obj)
 {
 }
Пример #31
0
 public Box(TestableGameObject obj, IBoxCollider collider,
     [Resource("mesh/cube")] TestableGameObject cubeMesh)
 {
     this.Obj = obj;
     cubeMesh.transform.Parent = obj.transform;
 }
Пример #32
0
 public HasInjectedGameObjects([GameObjectBoundary] TestableGameObject a, [GameObjectBoundary] TestableGameObject b) {
     this.a = a;
     this.b = b;
 }
Пример #33
0
 public IntervalBasedCallback(TestableGameObject obj, ITime time)
     : base(obj)
 {
     this.time = time;
 }
Пример #34
0
 public FakeAudioListener(TestableGameObject obj) : base(obj)
 {
 }
Пример #35
0
 public KeyboradInput(TestableGameObject obj, ICharacterInput input,
                      Character character) : base(obj)
 {
     this.Character       = character;
     this._characterInput = input;
 }
Пример #36
0
 public FakeSphereCollider(TestableGameObject obj)
     : base(obj)
 {
 }
Пример #37
0
 public FakeAudioListener(TestableGameObject obj)
     : base(obj)
 {
 }
Пример #38
0
 public HasSingletonScreen(TestableGameObject obj, IScreen screen) : base(obj)
 {
     injectedScreen = screen;
 }
Пример #39
0
 public FakeNavmeshAgent(TestableGameObject obj)
     : base(obj)
 {
 }
Пример #40
0
 public HasGameObjectBoundaryAsParameter(TestableGameObject obj, MockComponent nested)
     : base(obj)
 {
     this.nested = nested;
     this.nested.Obj.transform.Parent = this.Obj.transform;
 }
Пример #41
0
 public CharacterMobileInput(TestableGameObject go, IInput input)
     : base(go)
 {
     _input = input;
 }
Пример #42
0
 public HasOnCollision(TestableGameObject obj)
     : base(obj)
 {
 }
Пример #43
0
 public MockComponent(TestableGameObject obj) : base(obj)
 {
 }
Пример #44
0
 public HasSingletonScreen(TestableGameObject obj, IScreen screen)
     : base(obj)
 {
     injectedScreen = screen;
 }
Пример #45
0
 public HasMissingAttributedPrefab([Resource("does/not/exist")] TestableGameObject obj)
 {
 }
Пример #46
0
 public MockComponent(TestableGameObject obj)
     : base(obj)
 {
 }
Пример #47
0
 public HasInjectedGameObjects([GameObjectBoundary] TestableGameObject a, [GameObjectBoundary] TestableGameObject b)
 {
     this.a = a;
     this.b = b;
 }
Пример #48
0
 public MockTime(TestableGameObject obj)
     : base(obj)
 {
     DeltaTime = 1.0f;
 }
Пример #49
0
 public HasGameObjectBoundaryAsParameter(TestableGameObject obj, MockComponent nested) : base(obj)
 {
     this.nested = nested;
     this.nested.Obj.transform.Parent = this.Obj.transform;
 }
Пример #50
0
 public FakeSphereCollider(TestableGameObject obj) : base(obj)
 {
 }
Пример #51
0
 public HasInjectedPrefab(TestableGameObject parent, [Resource("mesh/sphere")] TestableGameObject nested) : base(parent)
 {
     this.nested             = nested;
     nested.transform.Parent = this.Obj.transform;
 }
Пример #52
0
 public Box(TestableGameObject obj, IBoxCollider collider,
            [Resource("mesh/cube")] TestableGameObject cubeMesh)
 {
     this.Obj = obj;
     cubeMesh.transform.Parent = obj.transform;
 }
Пример #53
0
 public HasSingletonTime(TestableGameObject obj, ITime time) : base(obj)
 {
     injectedTime = time;
 }
Пример #54
0
 public HasOnCollision(TestableGameObject obj) : base(obj)
 {
 }
Пример #55
0
 public FakeComponent(TestableGameObject obj)
     : base(obj)
 {
     this.obj = obj;
 }
Пример #56
0
 public FakeNavmeshAgent(TestableGameObject obj) : base(obj)
 {
 }
Пример #57
0
 public IntervalBasedCallback(TestableGameObject obj, ITime time) : base(obj)
 {
     this.time = time;
 }
Пример #58
0
 public MockTime(TestableGameObject obj) : base(obj)
 {
     DeltaTime = 1.0f;
 }
Пример #59
0
 public HasGameObjectBoundaryAsParameter(TestableGameObject obj, MockComponent nested)
     : base(obj)
 {
     this.nested = nested;
 }