Jypeli 10
The simple game programming library
Ignorer.cs
Siirry tämän tiedoston dokumentaatioon.
1#region MIT License
2/*
3 * Copyright (c) 2005-2008 Jonathan Mark Porter. http://physics2d.googlepages.com/
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22#endregion
23
24
25
26#if UseDouble
27using Scalar = System.Double;
28#else
29using Scalar = System.Single;
30#endif
31using System;
32using Jypeli.Physics;
33
34namespace Jypeli
35{
39 public abstract class Ignorer
40 {
42 internal static bool CanCollide( IPhysicsBody leftBody, IPhysicsBody rightBody, Ignorer left, Ignorer right )
43 {
44 return left.CanCollideInternal( leftBody, rightBody, right );
45 }
46 protected Ignorer() { }
47 protected Ignorer( Ignorer copy )
48 {
49 this.isInverted = copy.isInverted;
50 }
54 public bool IsInverted
55 {
56 get { return isInverted; }
57 set { isInverted = value; }
58 }
59 public abstract bool BothNeeded { get; }
60 private bool CanCollideInternal( IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other )
61 {
62 return isInverted ^ CanCollide( thisBody, otherBody, other );
63 }
64 public abstract bool CanCollide( IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other );
65 //public virtual void UpdateTime( TimeStep step ) { }
66 }
67}
System.Single Scalar
Definition: Clamped.cs:29
Base class for Collision Ignorers to impliment.
Definition: Ignorer.cs:40
static bool CanCollide(IPhysicsBody leftBody, IPhysicsBody rightBody, Ignorer left, Ignorer right)
Definition: Ignorer.cs:42
abstract bool BothNeeded
Definition: Ignorer.cs:59
bool IsInverted
Get and sets if the result of this ignorer is inverted.
Definition: Ignorer.cs:55
bool isInverted
Definition: Ignorer.cs:41
Ignorer(Ignorer copy)
Definition: Ignorer.cs:47
bool CanCollideInternal(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other)
Definition: Ignorer.cs:60
abstract bool CanCollide(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other)
Rajapinta fysiikkamoottorin tietämää fysiikkakappaletta varten.
Definition: IPhysicsBody.cs:10