Inheritance: MonoBehaviour
Esempio n. 1
0
    public void Start()
    {
        GameObject temp = GameObject.FindGameObjectWithTag("Spawner");

        //Debug.Log(temp);
        spawner = temp.GetComponent <EnemySpawning>();
    }
Esempio n. 2
0
    public void InitializeEnemies()
    {
        GameObject EnemySpawner = GameObject.Find("EnemySpawner");

        if (EnemySpawner == null)
        {
            return;
        }
        EnemySpawning es = EnemySpawner.GetComponent <EnemySpawning>();

        if (es == null)
        {
            return;
        }
        Vector3 chunkSize   = ChunkManager.Chunk2GlobalRate * Vector3.one;
        Vector3 chunkCenter = transform.position + chunkSize / 2;

        chunkCenter.y = 0;
        // print(chunkCenter);
        if (!es.IsInSpawnRegion(chunkCenter))
        {
            return;
        }
        // Spawn enemies in
        es.SpawnInChunkEnemies(chunkCenter, chunkSize);
    }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     actiontime   = 5;
     O_actiontime = actiontime;
     //wfs = new WaitForSeconds (animas[0].length);
     map = GameObject.FindGameObjectWithTag("Scripts").GetComponent <MapGen>();
     es  = GameObject.FindGameObjectWithTag("enemymanager").GetComponent <EnemySpawning>();
 }
Esempio n. 4
0
    void Start()
    {
        GameObject temp = GameObject.FindGameObjectWithTag("Spawner");

        //Debug.Log(temp);
        spawner  = temp.GetComponent <EnemySpawning>();
        shake    = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent <Shake>();
        soundNum = Random.Range(0, 6);
    }
Esempio n. 5
0
    void Awake()
    {
        SniperGroupA = GameObject.FindGameObjectWithTag("SniperSpawnsA");
        SniperGroupB = GameObject.FindGameObjectWithTag("SniperSpawnsB");
        SniperGroupC = GameObject.FindGameObjectWithTag("SniperSpawnsC");

        FlakGroupA = GameObject.FindGameObjectWithTag("FlakSpawnsA");
        FlakGroupB = GameObject.FindGameObjectWithTag("FlakSpawnsB");
        FlakGroupC = GameObject.FindGameObjectWithTag("FlakSpawnsC");

        playerObject = GameObject.FindGameObjectWithTag("Player");
        player       = playerObject.GetComponent <PlayerController>();

        enemyManager        = GameObject.FindGameObjectWithTag("Enemy Manager");
        enemySpawningScript = enemyManager.GetComponent <EnemySpawning>();

        objectiveText  = GameObject.Find("Canvas/ObjectiveText").GetComponent <Text>();
        objAmountText  = GameObject.Find("Canvas/objAmountText").GetComponent <Text>();
        scoreText      = GameObject.Find("Canvas/scoreText").GetComponent <Text>();
        gameController = GameObject.Find("GameStaticController").GetComponent <GameStaticController>();

        defendAreaObjectiveActive  = false;
        KillSnipersObjectiveActive = false;
        FlakCannonsObjectiveActive = false;
        doseAreaDefendExist        = false;

        DefendAreaLocated  = false;        //1
        KillSnipersLocated = false;        //2
        FlakCannonsLocated = false;        //3
        Area1Done          = false;
        Area2Done          = false;
        Area3Done          = false;

        //objArea.isActive = false;
        ObjectivesCompleted = 0;
        EnemySnipersDone    = false;
        FlakCannonsAmount   = 1;
        FlakCannonsKilled   = 0;
        FlakCannonsDone     = false;

        objectiveReward            = objectiveReward * gameController.scoreMultiplier;
        gameController.GlobalScore = 0;

        area1 = Random.Range(1, 4);
        area2 = Random.Range(1, 4);
        area3 = Random.Range(1, 4);

        objectiveText.text = "";
        objAmountText.text = "";

        gameController.gameMusic.Stop();
        gameController.gameMusic.loop   = true;
        gameController.gameMusic.clip   = gameController.gameFile;
        gameController.gameMusic.volume = 0.8f;
        gameController.gameMusic.Play();
    }
Esempio n. 6
0
 // This function is called when a collision with another object is detected.
 private void OnCollisionEnter2D(Collision2D coll)
 {
     // Checks if it's already collided then calculates the number of overtakes by using the amount of enemies spawned halved (to ignore simulator enemies).
     if (!collision)
     {
         GameObject    gameManager   = GameObject.Find("GameManager");
         EnemySpawning enemySpawning = gameManager.GetComponent <EnemySpawning>();
         numberOfOvertakes = enemySpawning.numberOfDespawns / 2;
         collision         = true;
     }
 }
Esempio n. 7
0
    void Start()
    {
        instance           = this;
        maxNumberOfEnemies = 2;
        maxY = spawnRadius[0].position.y;
        minY = spawnRadius[1].position.y;

        xSpawn = new float[2] {
            spawnRadius[0].position.x, spawnRadius[1].position.x
        };
    }
Esempio n. 8
0
        // Update is called once per frame
        private void Start()
        {
            GameObject EnemyManagerGameObject = GameObject.FindGameObjectWithTag("enemymanager");

            enemySpawner = EnemyManagerGameObject.GetComponent <EnemySpawning>();

            currentHealth        = maximumHealth;
            coolDowntimer        = AttackSpeed;
            agent.updateRotation = false;
            agent.updatePosition = true;
        }
    void Start()
    {
        wave  = 0;
        score = 0;
        //SetScoreText ();
        //winText.text = "";
        //Locating the gameObject holding the EnemySpawning script in the scene
        spawning  = GetComponent <EnemySpawning>();
        waveStart = GetComponent <AudioSource>();

        StartNewRound();
    }
Esempio n. 10
0
 internal EnemyID CurrentEnemyID; //this enemies type]
 private void Awake()
 {
     maincamera      = GameObject.Find("Main Camera");
     TeleportSound   = (AudioClip)Resources.Load("Audio/Sound Effects/RandomSfx/pot");
     KillZoneSound   = (AudioClip)Resources.Load("Audio/Sound Effects/RandomSfx/lvlup");
     DeathSound      = (AudioClip)Resources.Load("Audio/Sound Effects/AbstractPackSFX/Files/AbstractSfx/39");
     DamageSound     = (AudioClip)Resources.Load("Audio/Sound Effects/AbstractPackSFX/Files/AbstractSfx/73");
     CGG             = GameObject.Find("GameGrid").GetComponent <CreateGameGrid>().GetGrid(); //finding components needed
     GameManager     = GameObject.Find("GameManager").GetComponent <GameManagerStuff>();
     ESp             = GameObject.Find("EnemyController").GetComponent <EnemySpawning>();
     killzonepathing = new GameObject("killzone pathing");  //create a game ovbject past the last tile of the grid to aim for to ensure death by killzone collision
     Ally            = gameObject;
 }
 void Start()
 {
     spawner       = GameObject.Find("EnemySpawning").GetComponent <EnemySpawning>();
     ScoreSet      = GameObject.Find("UI").GetComponent <UI_Main>();
     UpgradeDetect = GameObject.Find("UpgradeBrain(Clone)").GetComponent <Upgrades>();
     if (gameObject.name.Contains("EnemyCorsair"))
     {
         enemyMoveSpeed = 1f; EnemyHealth = 16;
     }
     if (gameObject.name.Contains("EnemyFighter"))
     {
         enemyMoveSpeed = 2f; EnemyHealth = 8;
     }
 }
    void Awake()
    {
        playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
        player          = playerTransform.GetComponent <PlayerController>();

        enemyManager = GameObject.FindGameObjectWithTag("Enemy Manager");
        enemyScript  = enemyManager.GetComponent <EnemySpawning>();

        //triggerTarget = GameObject.FindGameObjectWithTag("Trigger Target").transform;

        isDead          = false;
        currentHealth   = startingHealth;
        currentMagazine = startingMagazine;
    }
Esempio n. 13
0
 public void ResetVariables()
 {
     Enemies_Killed = 0;
     GetPlayer_Monster.PlayerHealth   = 3;
     EnemyFollow.PlayerToEnemy_Damage = 1;
     GetPlayerMovement.PlayerMovSpeed = 100;
     BulletController.BulletRange     = 0.5f;
     GetPlayerShooting.BulletSpeed    = 0.1f;
     GetPlayerShooting.Player_Bullets.transform.localScale = new Vector3(2, 2, 0);
     GetPlayerShooting.cooldown = 2;
     GetPlayerShooting.Delay    = 1;
     EnemySpawning.SetOriginalState();
     GetBossSpawner.SetOriginalState();
 }
 // This is basically the start function for the base class.
 public void FindTheComponents()
 {
     UpgradeMaster = Resources.Load <GameObject>("Upgrades/UpgradesMaster") as GameObject;
     SetTheUpgrades();
     spawner                = GameObject.Find("EnemySpawning").GetComponent <EnemySpawning>();
     ScoreSet               = GameObject.Find("UI").GetComponent <UI_Main>();
     UpgradeDetect          = GameObject.Find("UpgradeBrain(Clone)").GetComponent <Upgrades>();
     AssetPool              = GameObject.Find("GameMaster").GetComponent <Pooling>();
     boxColFoV              = transform.GetChild(1).gameObject.GetComponent <BoxCollider>();
     objWeaponSpawnLocation = transform.GetChild(2).gameObject;
     fOriginAngle           = transform.eulerAngles.y;
     multiShotCount         = spawner.GetPlayerRef();
     StartingVectorX        = gameObject.transform.position.x;
     StartingVectorZ        = gameObject.transform.position.z;
 }
Esempio n. 15
0
    void Awake()
    {
        currentHP     = maxHP;
        enemySpawning = GetComponentInParent <EnemySpawning>();
        anim          = GetComponent <Animator>();

        player = GameObject.FindGameObjectWithTag("player");
        pM     = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerManager>();

        transform.parent = null;

        rb = GetComponent <Rigidbody2D>();

        sprRen = GetComponent <SpriteRenderer>();
    }
Esempio n. 16
0
    void Awake()
    {
        if (enemySpawning == null)
        {
            enemySpawning = this;
        }
        if (enemySpawning != this)
        {
            Destroy(this);
        }

        if (enemyHolder == null)
        {
            enemyHolder = new GameObject("Enemy holder");
        }
    }
    // Checks to see if the player is in either paused or in a menu, in which case don't spawn an enemy.
    private void Update()
    {
        GameObject      player       = GameObject.Find("Player");
        PlayerBehaviour playerScript = player.GetComponent <PlayerBehaviour>();
        bool            paused       = playerScript.paused;
        bool            mainMenu     = playerScript.mainMenu;

        if (!paused && !mainMenu)
        {
            transform.Translate(speed, Space.World);
            // Checks if the car is out of the screen bounds, then de-spawns if it is.
            if (transform.position.y < screenBottom)
            {
                GameObject    gameManager   = GameObject.Find("GameManager");
                EnemySpawning enemySpawning = gameManager.GetComponent <EnemySpawning>();
                enemySpawning.numberOfDespawns = enemySpawning.numberOfDespawns + 1;
                Destroy(gameObject);
            }
        }
    }
Esempio n. 18
0
    // Use this for initialization
    void Start()
    {
        level = 1;

        enemyTracker = GameObject.FindWithTag("Spawner").GetComponent <EnemySpawning>();
        statTracker  = GameObject.FindWithTag("EditorOnly").GetComponent <LevelData>();
        towerStuff   = GameObject.FindWithTag("Tower").GetComponent <TowerController>();
        states       = GameObject.FindWithTag("Events").GetComponent <MenuScript>();

        alreadyChanged = false;

        enemyTracker.spawnRate = Convert.ToSingle(statTracker.GetLevel(level)[1]);

        enemyTracker.remaining = Convert.ToInt32(statTracker.GetLevel(level)[3]);

        enemyTracker.spawnTime = Convert.ToInt32(statTracker.GetLevel(level)[4]);

        postTime = Convert.ToInt32(statTracker.GetLevel(level)[5]);

        condition = statTracker.GetLevel(level)[6];
    }
Esempio n. 19
0
    public static Stage Create()
    {
        GameObject go = new GameObject("Stage");

        StageInfo.instance.gameObject.transform.SetParent(go.transform);

        StageInfo.instance.Score     = 0;
        StageInfo.instance.HitPoints = 0;

        Utils.AssignTransformFromTo(Design.visibleArea.transform, go.transform);
        Utils.ProvideCanvas(go);

        Stage result = go.AddComponent <Stage>();

        EnemySpawning enemySpawning = go.AddComponent <EnemySpawning>();

        enemySpawning.onShipDeath = new UnityAction <Ship>(result.OnEnemyDeath);
        PlayerSpawning playerSpawning = go.AddComponent <PlayerSpawning>();

        playerSpawning.onShipDeath       = new UnityAction <Ship>(result.OnPlayerDeath);
        playerSpawning.onChangeHitPoints = new UnityAction <Ship>(result.OnPlayerChangeHitPoints);

        return(result);
    }
Esempio n. 20
0
 void Awake()
 {
     EnemySpawning.instance = this;
     EnemySpawning.instance.aliveChildren = 0;
 }
Esempio n. 21
0
 void Start()
 {
     EnemySpawning = GetComponent <EnemySpawning>();
 }
Esempio n. 22
0
 // Start is called before the first frame update
 void Start()
 {
     scr_EnemySpawning = GetComponent <EnemySpawning>();
     WaveStart();
 }