示例#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
文件: Box.cs 项目: banderous/Uniject
 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
文件: MockTime.cs 项目: gturk/Uniject
 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)
 {
 }
 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;
 }