public void AddCharacterSeenBy(GameCharacter c) { if (charsSeenBy.Contains(c)) { return; } charsSeenBy.Add(c); }
/////////// Protected /////////// protected void AddCharacter(GameCharacter c) { c.SetID(NextCharacterID); allCharacters.Add(c); UpdateCharacterView(c); Log.Log("Character added to instance. [" + c.Id + "]"); }
public void AddCharacterInView(GameCharacter c) { if (charsInView.Contains(c)) { return; } charsInView.Add(c); this.Inform_AddCharacterInView(c); }
/////////// Public /////////// public void AddCharacterToInstance(GameCharacter character, Position2D position = null) { if (position != null) { character.Position.Set(position); } this.Invoke(() => { this.AddCharacter(character); }); }
private void UpdateCharacterView(GameCharacter c) { foreach (var otherChar in allCharacters) { if (otherChar != c) { if (otherChar.CanSeeCharacter(c)) { otherChar.AddCharacterInView(c); c.AddCharacterSeenBy(otherChar); } if (c.CanSeeCharacter(otherChar)) { c.AddCharacterInView(otherChar); otherChar.AddCharacterSeenBy(c); } } } }
public abstract void Inform_RemoveCharacterInView(GameCharacter newChar);
public abstract void Inform_CharacterMovePoint(GameCharacter charFrom, MovePoint mp);
public abstract void Inform_CharacterTeleport(GameCharacter charFrom, Position2D pos);
public bool CanSeeCharacter(GameCharacter c) { //For now, everyone can see all characters in instance return(true); }
private void RemoveCharacter(GameCharacter c) { c.RemoveSeenByAllOther(); allCharacters.Remove(c); }