Esempio n. 1
0
        public void SpawnNazi(int path)
        {
            Nazi footSoldier = new Nazi(
                texture,
                pathWaypoints[path][0],
                initialFrame,
                Vector2.Zero);
            for (int x = 0; x < pathWaypoints[path].Count(); x++)
            {
                footSoldier.AddWaypoint(pathWaypoints[path][x]);
            }

            footSoldier.GetEnemyStats(EnemyType.FOOTSOLDIER);

            Nazis.Add(footSoldier);
        }
Esempio n. 2
0
        public void Shoot(Nazi target)
        {
            if (Vector2.Distance(this.Center, target.Center) <= range && TimeSinceLastShot > fireRate)
            {
                Vector2 enemyPos = target.Center;
                float distance = Vector2.Distance(target.Center, this.Center);
                float timeShot = distance / this.projectileSpeed;
                float distNazi = timeShot * target.speed;
                Vector2 enemyDirection = target.Velocity;
                enemyDirection.Normalize();
                enemyPos += (distNazi * enemyDirection) / 2;

                shotDirection = (enemyPos - Location);
                shotDirection.Normalize();

                TimeSinceLastShot = 0;
                TowerShotManager.shotSpeed = projectileSpeed;
                TowerShotManager.FireShot(
                    this.Center,
                    shotDirection);

            }
        }