public virtual void Fire(Actor ss, Slot s) { CurrentReloadTime = 0; Projectile p = (Projectile)Root.Instance.Factory.CreateInstance(ProjectileType); if (p.NoReplication || Root.Instance.IsAuthoritive) { p.Target = ss.Computer.Target; Matrix4 ship = ss.Matrix; Matrix4 slot = s.Matrix; Matrix4 combined = slot * ship; Vector3 x, y, z; Matrix4Extensions.ExtractBasis(combined, out x, out y, out z); p.Position = Matrix4Extensions.ExtractTranslation(combined); p.Orientation = Matrix4Extensions.ExtractRotation(combined); //p.localspeed=new Vector3(0,0,ExitingSpeed); p.Speed = z * ExitingSpeed; p.Source = ss; Root.Instance.Scene.Spawn(p); if (FireSound != null) p.PlaySound(FireSound, false); } //else p.Kill=true; }
public Computer(Actor owner) { Owner = owner; }
public ActorBaseControl(Actor target) { TargetActor = target; }
public override void Fire(Actor ss, Slot s) { base.Fire(ss, s); AmmoSource.Unload(AmmoType, 1); }
public override void Fire(Actor ss, Slot s) { base.Fire(ss, s); EnergySource.CurrentEnergy -= EnergyPerShot; }
public void TargetNext() { IList<Actor> actors = Root.Instance.Scene.FindEntitiesByType<Actor>(); foreach (Actor a in actors) { if (a != Owner && !a.Kill) { Target = (Actor)a; //System.Console.WriteLine("Computer aquired target: " + Target.ToString()); break; } } }
public Follow(SpaceShip owner, Actor target) : base(owner) { Target = target; }
public DestroyObjective(string text,Actor[] targets) : base(text) { Targets = targets; }
public EscortObjective(string text,Actor[] targets) : base(text) { Targets = targets; }
public RendevouzObjective(string text, Actor[] targets) : base(text) { Targets = targets; }
public override void ActorDestroy(Actor killer, Actor victim, Projectile p) { System.Console.WriteLine("actor destroyed."); if (!GameOver) PlayerKill(killer != null ? killer.Owner as Player : null, victim.Owner as Player, p); }
void UpdateInfo(ActorInfoWindow info, Actor actor) { if (info == null) return; if (actor != null && !actor.Kill) { info.Visible = true; Actor t = actor; float[] f = Root.Instance.UserInterface.Renderer.GetRasterPosition(Vector3Extensions.ToFloats(t.SmoothPosition)); Vector2 v = new Vector2(f[0],f[1]); v.Y = Root.Instance.UserInterface.Renderer.Size.Y - v.Y; info.Position = new Vector2((int)(v.X + 0.5f), (int)(v.Y + 0.5f)); if (t.Shield != null) info.ShieldBar.Value = t.Shield.CurrentCharge / t.Shield.MaxEnergy; else info.ShieldBar.Value = 0; if (t.Hull != null) info.HitpointBar.Value = t.Hull.CurrentHitpoints / t.Hull.MaxHitpoints; else info.HitpointBar.Value = 0; if (t.Battery != null) info.EneryBar.Value = t.Battery.CurrentCharge; else info.EneryBar.Value = 0; /* if (t is SpaceShip) { SpaceShip s = (SpaceShip)t; info.EneryBar.Value = s.Battery.CurrentCharge; } else info.EneryBar.Value = 0; */ if (actor.Owner != null) { info.Name.Caption = actor.Owner.Name; if (actor.Owner is Player && ((Player)actor.Owner).Team >= 0) info.Name.TextColor = Team.Colors[((Player)actor.Owner).Team]; else info.Name.TextColor = new Color4f(1, 1, 1, 1); } else { info.Name.TextColor = new Color4f(1, 1, 1, 1); info.Name.Caption = actor.Name; } } else info.Visible = false; }
public bool Transfer(Actor a) { if (a.Inventory != null && Items != null) { foreach (KeyValuePair<Type, int> kv in Items) { Cheetah.Console.WriteLine("transfering " + kv.Value.ToString() + " " + kv.Key.Name + " to " + a.ToString()); a.Inventory.Load(kv.Key, kv.Value); } return true; } return false; }
public Retreat(SpaceShip owner, Actor target) : base(owner) { Target = target; }
public void TargetNearest(Predicate<Actor> pred) { float distnow = float.PositiveInfinity; IList<Actor> actors = Root.Instance.Scene.FindEntitiesByType<Actor>(); foreach (Actor a in actors) { if (a != Owner && !a.Kill && pred(a)) { float dist = (((Node)a).AbsolutePosition - Owner.AbsolutePosition).Length; if (dist < distnow) { Target = (Actor)a; distnow = dist; } } } }
public CaptureObjective(string text, Actor[] targets) : base(text) { Targets = targets; }
public void TargetNearestToCursor(Vector3 c) { float distnow = float.PositiveInfinity; IList<Actor> actors = Root.Instance.Scene.FindEntitiesByType<Actor>(); foreach (Actor a in actors) { if (a != Owner && !a.Kill) { float dist = (((Node)a).AbsolutePosition - c).Length; if (dist < distnow) { Target = (Actor)a; distnow = dist; } } } /*foreach (KeyValuePair<int, Entity> de in Root.Instance.Scene.ClientList) { if (de.Value is Actor && de.Value != Owner && !de.Value.Kill) { float dist = (((Node)de.Value).AbsolutePosition - c).Length; if (dist < distnow) { Target = (Actor)de.Value; distnow = dist; } } }*/ //if (Target != null) // System.Console.WriteLine("Computer aquired target: " + Target.ToString()); }
public virtual void ActorDestroy(Actor killer, Actor victim, Projectile p) { }
/* public TargetInfo Scan() { if(Target==null) return null; TargetInfo ti = new TargetInfo(); ti.Dist = (Owner.AbsolutePosition - Target.AbsolutePosition).Length; }*/ public void Tick(float dtime) { //if (Target == null) // TargetNext(); if (Target != null && Target.Kill) { System.Console.WriteLine("Computer lost target: " + Target.ToString()); Target = null; } //if (TextMonitor == null) // throw new Exception(); }
public Attack(SpaceShip owner, Actor target) : base(owner) { Target = target; }