Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
KillableActor.cs
Go to the documentation of this file.
2 using UnityEngine;
3 
4 namespace droid.Runtime.Prototyping.Actors {
7  [AddComponentMenu(ActorComponentMenuPath._ComponentMenuPath + "Killable" + ActorComponentMenuPath._Postfix)]
8  public class KillableActor : Actor {
9  [SerializeField] bool _is_alive = true;
13  public bool IsAlive { get { return this._is_alive; } }
14 
18  public override string PrototypingTypeName { get { return "KillableActor"; } }
22  public void Kill() { this._is_alive = false; }
23 
24  public override void ApplyMotion(IMotion motion) {
25  if (this._is_alive) {
26  base.ApplyMotion(motion);
27  } else {
28  #if NEODROID_DEBUG
29  if (this.Debugging) {
30  Debug.Log("Actor is dead, cannot apply motion");
31  }
32  #endif
33  }
34  }
35 
36  public override void EnvironmentReset() {
37  base.EnvironmentReset();
38 
39  this._is_alive = true;
40  }
41  }
42 }
override void ApplyMotion(IMotion motion)