public ShelledLifelet(Lifelet lifelet, World world) { // Init _lifelet = lifelet; _world = world; _validWorldAge = _world.Age; }
public Message(World world, char contents, Lifelet sender) : base(world,sender.Position) { // Init _contents = contents; _maxAge = Math2.JitteredValue(Config.MessageMaxAge,Config.MessageMaxAgeJitter); _sender = sender; }
public double Distance(Lifelet other) { return this.Position.Distance(other.Position); }
public void Simulate() { // Init _highlightedLifelet = null; _age++; // Food foreach(Food food in _food) { food.Simulate(); } // Messages foreach(Message message in _messages) { message.Simulate(); } // Loop life forms foreach(Lifelet life in _lifelets) { // Simulate life.PrepareSimulate(); life.Simulate(); // Check that the simulation was performed properly if(life.DidSimulate != true) { throw new Exception("Implementing class did not call base Simulate()!"); } // Highlighted? if(life.Distance(new Vector(_cursor.X,_cursor.Y)) < Config.DisplayMouseSensitivity) _highlightedLifelet = life; } }
public void RemoveLifelet(Lifelet life) { _lifelets.Remove(life); }
public double Distance(Lifelet other) { checkIfValid(); return _lifelet.Distance(other); }
private void recieveEnergy(Lifelet sender, double amount) { //TODO: should we tax this with a conversion ratio? _energy += amount; }
private void recieveAttack(Lifelet sender, double amount) { //TODO: should we tax this with a conversion ratio? _health -= 50.0;//(amount*4); //TODO }