public GameEntity(GameEntity copy)
     : base(copy)
 {
     //visibilityBoundingInited = copy.visibilityBoundingInited;
     editorSelectable = copy.editorSelectable;
     EditorMinRandomScale = copy.EditorMinRandomScale;
     EditorMaxRandomScale = copy.EditorMaxRandomScale;
     EditorFollowGroundType = copy.EditorFollowGroundType;
     EditorRandomRotation = copy.EditorRandomRotation;
 }
 public override void Set(GameEntity entity)
 {
     var d = entity as Unit;
     if (d == null) return;
     d.PistolAmmo = Ammo;
 }
 public override void Set(GameEntity entity)
 {
     var d = entity as Destructible;
     if (d == null) return;
     d.State = State;
 }
 public override bool IsActive(GameEntity entity)
 {
     var d = entity as Destructible;
     if (d == null) return false;
     return d.State == State;
 }
 public override void Set(GameEntity entity)
 {
     var d = entity as Unit;
     if (d == null) return;
     d.InCombat = Value;
 }
 public override bool IsActive(GameEntity entity)
 {
     var d = entity as Unit;
     if (d == null) return false;
     return d.InCombat == Value;
 }
 public override bool IsActive(GameEntity entity)
 {
     var d = entity as Unit;
     if (d == null) return false;
     return d.PistolAmmo == (int)Ammo;
 }
 public override bool IsActive(GameEntity entity)
 {
     var d = entity as Destructible;
     if (d == null) return false;
     int val;
     if (Percentage)
         val = (int)(HitPoints * d.MaxHitPoints);
     else
         val = (int)HitPoints;
     switch(Comparison)
     {
         case ComparisonOperator.Equals:
             return d.HitPoints == val;
         case ComparisonOperator.LessThan:
             return d.HitPoints < val;
         case ComparisonOperator.GreaterThan:
             return d.HitPoints > val;
         default:
             throw new ArgumentException();
     }
 }
 public override bool IsActive(GameEntity entity)
 {
     var d = entity as Unit;
     if (d == null) return false;
     return d.RageLevel == (int)RageLevel;
 }
 public override void Set(GameEntity entity)
 {
     var d = entity as Destructible;
     if (d == null) return;
     if (Percentage)
         SetValue(d, (int)(GetValue(d) * GetMaxValue(d)));
     else
         SetValue(d, Value);
 }
 public override bool IsActive(GameEntity entity)
 {
     var d = entity as Destructible;
     if (d == null) return false;
     int val;
     if (Percentage)
         val = (int)(GetValue(d) * GetMaxValue(d) / 100);
     else
         val = (int)GetValue(d);
     switch (Comparison)
     {
         case ComparisonOperator.Equals:
             return GetValue(d) == val;
         case ComparisonOperator.LessThan:
             return GetValue(d) < val;
         case ComparisonOperator.GreaterThan:
             return GetValue(d) > val;
         default:
             throw new ArgumentException();
     }
 }
 public abstract void Set(GameEntity entity);
 public abstract bool IsActive(GameEntity entity);
 public override void Set(GameEntity entity)
 {
     var d = entity as Destructible;
     if (d == null) return;
     if (Percentage)
         d.HitPoints = (int)(HitPoints * d.MaxHitPoints);
     else
         d.HitPoints = (int)HitPoints;
 }
예제 #15
0
 protected override void PerformingTick()
 {
     base.PerformingTick();
     if (lastSpawn == null)
     {
         lastSpawn = (GameEntity)Activator.CreateInstance(Type);
         var p = Game.Instance.Scene.GetByName(Point);
         lastSpawn.Position = p.Translation;
         var u = lastSpawn as Unit;
         if (u != null)
         {
             u.CanControlMovementBlockers++;
             u.CanControlRotationBlockers++;
             u.CanPerformAbilitiesBlockers++;
         }
         lastSpawn.EditorInit();
         lastSpawn.GameStart();
         Game.Instance.Scene.Root.AddChild(lastSpawn);
         Game.Instance.Scene.Root.AddChild(new Effects.SpawnEntityEffect { Translation = p.Translation });
     }
     else
     {
         var u = lastSpawn as Unit;
         if (lastSpawn.IsRemoved || (u != null && u.State != UnitState.Alive))
         {
             lastSpawn = null;
         }
     }
 }
 public override void Set(GameEntity entity)
 {
     var d = entity as Unit;
     if (d == null) return;
     d.RageLevel = RageLevel;
 }
예제 #17
0
 public bool AddBuff(Buff buff, Unit performer, GameEntity mediator)
 {
     if (!CanAddBuff(buff)) return false;
     buff.Performer = performer;
     buff.Mediator = mediator;
     if (IsInGame)
     {
         if (CanAddBuff(buff))
         {
             buff.TargetPosition = this.Position;
             buff.TargetEntity = this;
             if(buff.TryStartPerform())
                 ActiveBuffs.Add(buff);
         }
     }
     else
         ActiveBuffs.Add(buff);
     return true;
 }