Exemplo n.º 1
0
        private List <IBehaviour> CreateBehavioursFromAbbreviatedNames(HashSet <string> abbreviatedNames)
        {
            // We must give each bot its own list of instantiated behaviours since they store state.
            List <IBehaviour> behaviours = new List <IBehaviour>();

            // Hard-coded for now
            foreach (string abName in abbreviatedNames)
            {
                IBehaviour newBehaviour = null;

                if (abName == "c")
                {
                    newBehaviour = new CrossBehaviour();
                }

                if (abName == "g")
                {
                    newBehaviour = new GrabbingBehaviour();
                }

                if (abName == "n")
                {
                    newBehaviour = new NoneBehaviour();
                }

                if (abName == "p")
                {
                    newBehaviour = new PhysicsBehaviour();
                }

                if (abName == "t")
                {
                    newBehaviour = new TeleportBehaviour();
                }

                if (abName == "tw")
                {
                    newBehaviour = new TwitchyBehaviour();
                }

                if (abName == "ph2")
                {
                    newBehaviour = new PhysicsBehaviour2();
                }

                if (newBehaviour != null)
                {
                    behaviours.Add(newBehaviour);
                }
                else
                {
                    MainConsole.Instance.OutputFormat("No behaviour with abbreviated name {0} found", abName);
                }
            }

            return(behaviours);
        }
Exemplo n.º 2
0
        private List<IBehaviour> CreateBehavioursFromAbbreviatedNames(HashSet<string> abbreviatedNames)
        {
            // We must give each bot its own list of instantiated behaviours since they store state.
            List<IBehaviour> behaviours = new List<IBehaviour>();

            // Hard-coded for now    
            foreach (string abName in abbreviatedNames)
            {
                IBehaviour newBehaviour = null;

                if (abName == "c")
                    newBehaviour = new CrossBehaviour();

                if (abName == "g")
                    newBehaviour = new GrabbingBehaviour();

                if (abName == "n")
                    newBehaviour = new NoneBehaviour();

                if (abName == "p")
                    newBehaviour = new PhysicsBehaviour();

                if (abName == "t")
                    newBehaviour = new TeleportBehaviour();

                if (abName == "tw")
                    newBehaviour = new TwitchyBehaviour();

                if (abName == "ph2")
                    newBehaviour = new PhysicsBehaviour2();

                if (abName == "inv")
                    newBehaviour = new InventoryDownloadBehaviour();

                if (newBehaviour != null)
                {
                    behaviours.Add(newBehaviour);
                }
                else
                {
                    MainConsole.Instance.OutputFormat("No behaviour with abbreviated name {0} found", abName);
                }
            }

            return behaviours;
        }