protected override bool OnGameObjectCollision(GameObject collider) { if (collider is MoneyBall) { if (soul == null) { return true; } MoneyBall moneyBall = collider as MoneyBall; if (Wallet < Cost) { wallet += moneyBall.Value; ActiveScene.Scene.RemoveAndUninitialize(collider); } if (Wallet >= Cost) { moneyBall.Parent.AddSoul(this.soul); this.soul = null; ActiveScene.Scene.RemoveAndUninitialize(this); ActiveScene.Scene.AddAndInitialize(new Husk("black", this.worldPosition, this.worldScale)); } return true; } return base.OnGameObjectCollision(collider); }
public void AddSoul(Soul soul) { soul.RegisterPlayer(this); portfolio.Add(soul); }
public NPC(string spriteName, Soul soul, int cost, Vector2 initialPosition, Vector2 size) : base(spriteName, initialPosition, size) { this.soul = soul; this.cost = cost; }