Paradox Game Engine
v1.0.0 beta06
Main Page
Related Pages
Packages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Events
Macros
Pages
EntityComponent.cs
Go to the documentation of this file.
1
// Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2
// This file is distributed under GPL v3. See LICENSE.md for details.
3
using
System
;
4
using
System.Runtime.CompilerServices;
5
6
using
SiliconStudio.Core.Serialization.Converters;
7
using
SiliconStudio.Core;
8
using
SiliconStudio.Core.Serialization.Serializers;
9
10
namespace
SiliconStudio.
Paradox
.EntityModel
11
{
12
[
DataConverter
(AutoGenerate =
false
, ContentReference =
true
)]
13
[DataSerializer(typeof(EntityComponentSerializer<>), Mode =
DataSerializerGenericMode
.Type)]
14
public
class
EntityComponent
:
IContentUrl
15
{
16
/// <summary>
17
/// Initializes a new instance of the <see cref="EntityComponent"/> class.
18
/// </summary>
19
public
EntityComponent
()
20
{
21
}
22
23
/// <summary>
24
/// Gets or sets the owner entity.
25
/// </summary>
26
/// <value>
27
/// The owner entity.
28
/// </value>
29
public
Entity
Entity
{
get
; set; }
30
31
/// <summary>
32
/// Gets the entity and throws an exception if the entity is null.
33
/// </summary>
34
/// <value>The entity.</value>
35
/// <exception cref="System.InvalidOperationException">Entity on this instance is null</exception>
36
protected
Entity
EnsureEntity
37
{
38
get
39
{
40
if
(
Entity
== null)
41
throw
new
InvalidOperationException(
string
.Format(
"Entity on this instance [{0}] cannot be null"
, GetType().Name));
42
return
Entity
;
43
}
44
}
45
46
string
IContentUrl.Url {
get
; set; }
47
48
/// <summary>
49
/// The default key this component is associated to.
50
/// </summary>
51
public
virtual
PropertyKey
DefaultKey
52
{
53
get
54
{
55
throw
new
NotImplementedException();
56
}
57
}
58
59
/// <summary>
60
/// Gets the default key for the specified entity component type.
61
/// </summary>
62
/// <typeparam name="T">An entity component type</typeparam>
63
/// <returns>PropertyKey.</returns>
64
[MethodImpl(MethodImplOptions.AggressiveInlining)]
65
public
static
PropertyKey
GetDefaultKey<T>() where T :
EntityComponent
,
new
()
66
{
67
return
EntityComponentHelper<T>.DefaultKey;
68
}
69
70
struct
EntityComponentHelper<T> where T : EntityComponent, new()
71
{
72
public
static
readonly
PropertyKey
DefaultKey =
new
T().DefaultKey;
73
}
74
}
75
}
SiliconStudio.Core.IContentUrl
Interface for serializable object having an url (so referenceable by other assets and saved into a si...
Definition:
IContentUrl.cs:8
SiliconStudio.Paradox.EntityModel.Entity
Game entity. It usually aggregates multiple EntityComponent
Definition:
Entity.cs:28
SiliconStudio.Paradox.EntityModel.EntityComponent
Definition:
EntityComponent.cs:14
SiliconStudio.Core.Serialization.Serializers.DataSerializerGenericMode
DataSerializerGenericMode
Defines what generic parameters to pass to the serializer.
Definition:
DataSerializerGenericMode.cs:8
SiliconStudio.Paradox.EntityModel.EntityComponent.EntityComponent
EntityComponent()
Initializes a new instance of the EntityComponent class.
Definition:
EntityComponent.cs:19
SiliconStudio.Core.Serialization.Converters.DataConverter
Base class for converters to/from a data type.
Definition:
DataConverter.cs:10
SiliconStudio.Shaders.Parser.System
A system file.
SiliconStudio.Paradox.Graphics.Paradox
Paradox image file.
SiliconStudio.Core.PropertyKey
A class that represents a tag propety.
Definition:
PropertyKey.cs:17
sources
engine
SiliconStudio.Paradox.Engine
EntityModel
EntityComponent.cs
Generated on Sat Dec 20 2014 21:51:42 for Paradox Game Engine by
1.8.7