-
Notifications
You must be signed in to change notification settings - Fork 4
/
ActorTargetedConstraint.cs
47 lines (41 loc) · 1.15 KB
/
ActorTargetedConstraint.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.IO;
using System.Collections.Generic;
namespace Nima
{
public abstract class ActorTargetedConstraint : ActorConstraint
{
protected ushort m_TargetIdx;
protected ActorComponent m_Target;
public ActorComponent Target
{
get
{
return m_Target;
}
}
public static ActorTargetedConstraint Read(Actor actor, BinaryReader reader, ActorTargetedConstraint component)
{
ActorConstraint.Read(actor, reader, component);
component.m_TargetIdx = reader.ReadUInt16();
return component;
}
public override void ResolveComponentIndices(ActorComponent[] components)
{
base.ResolveComponentIndices(components);
if(m_TargetIdx != 0)
{
m_Target = components[m_TargetIdx];
if(m_Target != null)
{
m_Actor.AddDependency(m_Parent, m_Target);
}
}
}
public void Copy(ActorTargetedConstraint node, Actor resetActor)
{
base.Copy(node, resetActor);
m_TargetIdx = node.m_TargetIdx;
}
}
}