コード例 #1
0
        private void AddStudent()
        {
            /*Randomly select a student to add*/
            int random = new Random().Next();
            Student student = new Student(studentTextureArray[random%4],
                map.Waypoints.Peek(), 30+10*waveNumber, 2+waveNumber, 0.75f+0.2f*waveNumber, random%4);

            student.SetWaypoints(map.Waypoints);

            students.Add(student);

            spawnTimer = 0;
            studentsSpawned++;
        }
コード例 #2
0
ファイル: Teacher.cs プロジェクト: zjusbo/attack-on-geeks-pc
        public virtual void GetClosestStudent(List<Student> students)
        {
            /*Get the closest student and set it to be the target*/
            target = null;
            float smallestRange = radius;

            foreach (Student student in students)
            {
                if (Vector2.Distance(center, student.Center) < smallestRange)
                {
                    smallestRange = Vector2.Distance(center, student.Center);
                    target = student;
                }
            }
        }
コード例 #3
0
ファイル: Teacher.cs プロジェクト: zjusbo/attack-on-geeks-pc
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            paperTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;

            /*Set the refresh speed of the paper images*/ 
            if (target != null )
            {
                FaceTarget();

                if (!IsInRange(target.Center) || target.IsDead)
                {
                    target = null;
                    paperTimer = 0;
                }
                RefreshSpeed = 4;
            }
            else
            {
                RefreshSpeed = 0;
            }
        }