Jypeli
10
The simple game programming library
AdvGroupIgnorer.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
27
using
Scalar
=
System
.Double;
28
#else
29
using
Scalar
=
System
.Single;
30
#endif
31
using
System
;
32
using
Jypeli
.
Physics
;
33
34
namespace
Jypeli
35
{
40
public
class
AdvGroupIgnorer
:
Ignorer
41
{
42
GroupCollection
groups
;
43
GroupCollection
ignoredGroups
;
44
public
AdvGroupIgnorer
()
45
{
46
this.groups =
new
GroupCollection
();
47
this.ignoredGroups =
new
GroupCollection
();
48
}
49
protected
AdvGroupIgnorer
(
AdvGroupIgnorer
copy )
50
: base( copy )
51
{
52
this.groups =
new
GroupCollection
( copy.
groups
);
53
this.groups =
new
GroupCollection
( copy.
ignoredGroups
);
54
}
55
public
override
bool
BothNeeded
56
{
57
get
{
return
true
; }
58
}
59
public
GroupCollection
Groups
{
get
{
return
groups
; } }
60
public
GroupCollection
IgnoredGroups
{
get
{
return
ignoredGroups
; } }
61
public
bool
CanCollide
(
AdvGroupIgnorer
other )
62
{
63
if
( other ==
null
) {
throw
new
ArgumentNullException(
"other"
); }
64
return
CanCollideInternal
( other );
65
}
66
private
bool
CanCollideInternal
(
AdvGroupIgnorer
other )
67
{
68
return
!
GroupCollection
.
Intersect
(
ignoredGroups
, other.
groups
);
69
}
70
public
override
bool
CanCollide
(
IPhysicsBody
thisBody,
IPhysicsBody
otherBody,
Ignorer
other )
71
{
72
AdvGroupIgnorer
value = other as
AdvGroupIgnorer
;
73
return
74
value ==
null
||
75
CanCollideInternal
( value );
76
}
77
public
virtual
object
Clone
()
78
{
79
return
new
AdvGroupIgnorer
(
this
);
80
}
81
}
82
}
Scalar
System.Single Scalar
Definition:
Clamped.cs:29
Jypeli.AdvGroupIgnorer
A collision ignorer that uses group numbers to do collision ignoring. If a object is member of a grou...
Definition:
AdvGroupIgnorer.cs:41
Jypeli.AdvGroupIgnorer.CanCollideInternal
bool CanCollideInternal(AdvGroupIgnorer other)
Definition:
AdvGroupIgnorer.cs:66
Jypeli.AdvGroupIgnorer.AdvGroupIgnorer
AdvGroupIgnorer(AdvGroupIgnorer copy)
Definition:
AdvGroupIgnorer.cs:49
Jypeli.AdvGroupIgnorer.Groups
GroupCollection Groups
Definition:
AdvGroupIgnorer.cs:59
Jypeli.AdvGroupIgnorer.ignoredGroups
GroupCollection ignoredGroups
Definition:
AdvGroupIgnorer.cs:43
Jypeli.AdvGroupIgnorer.AdvGroupIgnorer
AdvGroupIgnorer()
Definition:
AdvGroupIgnorer.cs:44
Jypeli.AdvGroupIgnorer.Clone
virtual object Clone()
Definition:
AdvGroupIgnorer.cs:77
Jypeli.AdvGroupIgnorer.CanCollide
bool CanCollide(AdvGroupIgnorer other)
Definition:
AdvGroupIgnorer.cs:61
Jypeli.AdvGroupIgnorer.IgnoredGroups
GroupCollection IgnoredGroups
Definition:
AdvGroupIgnorer.cs:60
Jypeli.AdvGroupIgnorer.CanCollide
override bool CanCollide(IPhysicsBody thisBody, IPhysicsBody otherBody, Ignorer other)
Definition:
AdvGroupIgnorer.cs:70
Jypeli.AdvGroupIgnorer.groups
GroupCollection groups
Definition:
AdvGroupIgnorer.cs:42
Jypeli.AdvGroupIgnorer.BothNeeded
override bool BothNeeded
Definition:
AdvGroupIgnorer.cs:56
Jypeli.GroupCollection
A collection that stores ints that represent groups
Definition:
GroupCollection.cs:40
Jypeli.GroupCollection.Intersect
static bool Intersect(GroupCollection groups1, GroupCollection groups2)
Definition:
GroupCollection.cs:41
Jypeli.Ignorer
Base class for Collision Ignorers to impliment.
Definition:
Ignorer.cs:40
Jypeli.Physics.IPhysicsBody
Rajapinta fysiikkamoottorin tietämää fysiikkakappaletta varten.
Definition:
IPhysicsBody.cs:10
Jypeli.Physics
Definition:
Collision.cs:5
Jypeli
Definition:
Automobile.cs:5
System
Definition:
CFFauxAttributes.cs:29
Jypeli
Physics
Ignorers
AdvGroupIgnorer.cs
Generoinut projektille Jypeli Tue Sep 14 2021 15:57:42
1.9.2