Exemple #1
0
        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);
        }
Exemple #2
0
 public void AddSoul(Soul soul)
 {
     soul.RegisterPlayer(this);
     portfolio.Add(soul);
 }
Exemple #3
0
 public NPC(string spriteName, Soul soul, int cost, Vector2 initialPosition, Vector2 size)
     : base(spriteName, initialPosition, size)
 {
     this.soul = soul;
     this.cost = cost;
 }