Beispiel #1
0
        public void CalculatePriceMultipler()
        {
            Npc             npcRow = new Npc();
            NpcGoodBalancer npc    = new NpcGoodBalancer(npcRow);

            for (int goodCount = 0; goodCount < 20; goodCount++)
            {
                double priceMultipler1 = npc.CalculatePriceMultipler(100, 9, goodCount);
                double priceMultipler2 = npc.CalculatePriceMultiplerOld(100, 9, goodCount);

                Debug.WriteLine(string.Format("GoodCount: {0} New: {1} Old: {2}", goodCount, priceMultipler1, priceMultipler2));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Does the action.
        /// </summary>
        public virtual void DoAction()
        {
            Logger.Write(string.Format("Processing NpcId: {0}", this.NpcId), "NPC", 20, 0, TraceEventType.Start, "Npc.DoAction");
            NpcBase npc = null;

            switch (this.NType)
            {
            case NpcType.GoodBalancer:
                // Special system good price/count balancer NPC
                npc = new NpcGoodBalancer(this);
                break;

            case NpcType.NpcBalancer:
                // Npc Balancer NPC
                npc = new NpcBalancer(this);
                break;

            case NpcType.Cleaner:
                // Cleaner NPC
                npc = new NpcCleaner(this);
                break;

            case NpcType.Trader:
                // Trader NPC
                npc = new NpcTrader(this);
                break;

            case NpcType.Pirate:
                // Pirate NPC
                npc = new NpcPirate(this);
                break;

            case NpcType.Police:
                // Police NPC
                npc = new NpcPolice(this);
                break;

            default:
                throw new ArgumentOutOfRangeException("NType", this.NType, "Invalid NPC Type");
            }

            // Do the actual NPC action
            npc.DoAction();
        }