void OnEnable()
    {
        path = (DroidPath)target;

        labelStyle.fontStyle = FontStyle.Bold;
        labelStyle.fontSize = 24;
        labelStyle.normal.textColor = Color.green;
    }
    void Start()
    {
        droidInformation = GetComponent<DroidInformation>();
        path = GetComponent<DroidPath>();

        droidInformation.CharacterStateChanged += EnemyInformation_CharacterStateChanged;

        mode = DroidMode.SeekingPoint;
        StartCoroutine(SeekPoint(path.NextPoint));
    }
示例#3
0
    //Method to spawn fighters
    public void spawnFighter(GameObject droidFighter, DroidPath droidPath, Vector3 pos )
    {
        //Instantiate fighter and attach script
        GameObject fighter = Instantiate(droidFighter, pos, Quaternion.identity) as GameObject;

        fighter.GetComponent<DroidPath>().seekEnabled = true;
        fighter.GetComponent<DroidPath>().wanderEnabled = true;
        fighter.GetComponent<DroidPath>().Seek(pos);
        fighter.GetComponent<DroidPath>().timeToLive = 8;

        nextSpawn = Time.time + spawnInterval;
    }
示例#4
0
        public static void Problems()
        {
            Console.WriteLine("Input file:");
            string fileName = Console.ReadLine();

            while (!File.Exists(fileName))
            {
                Console.WriteLine("file not found - try again:");
                fileName = Console.ReadLine();
            }

            //inputs
            //north (1), south (2), west (3), and east (4)

            //outputs

            /*
             *  0: The repair droid hit a wall. Its position has not changed.
             *  1: The repair droid has moved one step in the requested direction.
             *  2: The repair droid has moved one step in the requested direction; its new position is the location of the oxygen system.
             *
             */

            bool done = false;

            Dictionary <int, HashSet <int> > walls = new Dictionary <int, HashSet <int> >();
            Dictionary <int, HashSet <int> > found = new Dictionary <int, HashSet <int> >();
            Queue <DroidPath> next  = new Queue <DroidPath>();
            DroidPath         start = new DroidPath();

            found[0] = new HashSet <int>();
            found[0].Add(0);
            AddNextPaths(next, start, walls, found);

            DroidPath oxygenLocation = new DroidPath();

            while (!done && next.Count > 0)
            {
                //dequeue next item
                DroidPath d = next.Dequeue();
                //run computer to end of inputs
                Computer c = new Computer(fileName);
                foreach (int m in d.stepOrder)
                {
                    c.Processor.Input(m);
                }
                c.Run();

                //read last output queue item
                long[] output = c.Processor.OutputQueue.ToArray();
                switch (output[^ 1])