Esempio n. 1
0
 private void Awake()
 {
     GetSpawnEnemy     = this;
     currentEnemyCount = 0;
     currentWave       = 0;
     finishWave        = false;
 }
Esempio n. 2
0
 void MakeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Esempio n. 3
0
    Vector3 m_pos;                    // Position of the enemy.

    void Start()
    {
        rb             = GetComponent <Rigidbody2D>();
        m_enemyHandler = GetComponent <SpawnEnemy>();
        m_pos          = transform.position;
        m_bDead        = false;
    }
Esempio n. 4
0
    void Update()
    {
        float posLeft1 = cam.transform.position.x - 8f;
        float posLeft2 = posLeft1 + 18f;
        float posRight = posLeft2 + 10f;

        for (int i = 0; i < count; i++)
        {
            SpawnEnemy spawnEnemy = spawnEnemies[i];
            Vector3    pos        = spawnEnemy.gameObject.transform.position;
            float      posX       = pos.x;
            float      posY       = pos.y;
            if (posX > posLeft1)
            {
                if ((posLeft2 < posX && posX < posRight) || (posY > camUp && posX < posLeft2))
                {
                    spawnEnemy.timer -= Time.deltaTime;
                    if (spawnEnemy.timer < 0f)
                    {
                        spawnEnemy.Spawn();
                    }
                }
            }
        }
    }
Esempio n. 5
0
    // Start is called before the first frame update
    void Start()
    {
        player1 = (Player1)FindObjectOfType(typeof(Player1));
        dead    = false;
        maxLive = liveScale;
        worth   = worthScale;
        live    = maxLive;


        startMoved  = false;
        randomFloat = Random.value * moveDistance;

        enemySpawner = (SpawnEnemy)FindObjectOfType(typeof(SpawnEnemy));

        Vector3 temp = new Vector3(transform.position.x / 0.16f + 640f, transform.position.y / 0.16f + 340f, transform.position.z / 0.15f);


        ProgressBar obj = Instantiate(pb, temp, Quaternion.identity);

        obj.MaxLive  = maxLive;
        obj.Live     = live;
        obj.BarValue = live / maxLive * health;
        obj.transform.SetParent(gameObject.GetComponentInChildren <Canvas>().gameObject.transform, gameObject);


        sectorTime     = Time.time - sectorDelay;
        shootTime      = Time.time - simpleDelay;
        circleTime     = Time.time - circle1Delay;
        circleTime2    = Time.time - circle2Delay;
        realRainTime   = Time.time - realDelay;
        rainTime       = Time.time - hardDelay;
        rainNormalTime = Time.time - normalDelay;
        shootTraceTime = Time.time - traceDelay;
    }
 void Start()
 {
     enemyManager           = FindObjectOfType <SpawnEnemy> ();
     enemyManager.bossFight = true;
     animator = GetComponent <Animator> ();
     Invoke("WeaponsReady", 2.5f);
 }
Esempio n. 7
0
    IEnumerator Spawning(SpawnEnemy spawnEnemy)
    {
        spawnEnemy.isSpawnEnd = true;
        SpawnEffect();
        GameObject e = Instantiate(spawnEnemy.enemyPrefab, enemySpawnPoint);

        e.SetActive(false);
        e.GetComponent <Hero>().isPlayerHero = false;
        e.transform.position = this.transform.position;
        yield return(new WaitForEndOfFrame());

        e.SetActive(true);
        StageManagement.instance.AddMonsterCount();
        List <GameObject> allys = Common.FindAlly();

        foreach (var ally in allys)
        {
            if (ally.GetComponent <Hero>() != null)
            {
                ally.GetComponent <Hero>().ResearchingEnemys(e);
            }
        }
        yield return(new WaitForSeconds(spawnTime));

        spawnEnemy.isSpawnEnd = false;
        spawnCount            = Common.FindEnemysCount();
        yield return(null);
    }
Esempio n. 8
0
        /**
         * create the list of action use in the game
         * set the logo for each action
         */
        public List <Action> GetActionList()
        {
            List <Action> actionList = new List <Action>();

            foreach (ACTION_TYPE type in ActionInTimeline)
            {
                switch (type)
                {
                case ACTION_TYPE.ATTACK:
                {
                    Attack attack = new Attack();
                    attack.actionLogo = attackLogo;
                    actionList.Add(attack);
                }
                break;

                case ACTION_TYPE.DEFEND:
                {
                    Defend defend = new Defend();
                    defend.actionLogo = defendLogo;
                    actionList.Add(defend);
                }
                break;

                case ACTION_TYPE.CURSE:
                {
                    Curse curse = new Curse();
                    curse.actionLogo = curseLogo;
                    actionList.Add(curse);
                }
                break;

                case ACTION_TYPE.MOVE_ENEMY:
                {
                    MoveEnemy moveEnemy = new MoveEnemy();
                    moveEnemy.actionLogo = moveEnemyLogo;
                    actionList.Add(moveEnemy);
                }
                break;

                case ACTION_TYPE.SPAWN_ENEMY:
                {
                    SpawnEnemy spawnEnemy = new SpawnEnemy();
                    spawnEnemy.actionLogo = spawnEnemyLogo;
                    actionList.Add(spawnEnemy);
                }
                break;

                case ACTION_TYPE.SPAWN_FOW:
                {
                    SpawnFOW spawnFOW = new SpawnFOW();
                    spawnFOW.actionLogo = spawnFOWLogo;
                    actionList.Add(spawnFOW);
                }
                break;
                }
            }
            return(actionList);
        }
Esempio n. 9
0
    void Start()

    {
        hp      = gameObject.GetComponent <HitPoints>();
        sp      = gameObject.GetComponent <SpawnEnemy>();
        hook    = gameObject.GetComponent <Transform>();
        startHp = hp.health;
    }
Esempio n. 10
0
 void Start()
 {
     SpawnEnemy       = GameObject.Find("Spawner");
     SpawnEnemyScript = SpawnEnemy.GetComponent <SpawnEnemy>();
     targetPos        = transform.position;
     teleportCD       = 0;
     attackReady      = true;
 }
Esempio n. 11
0
 private void Awake()
 {
     Instance = this;
     regionNumberToSpawnPointsNumber.Add(1, spawnPointsRegionOne);
     regionNumberToSpawnPointsNumber.Add(2, spawnPointsRegionTwo);
     regionNumberToSpawnPointsNumber.Add(3, spawnPointsRegionThree);
     playerPosition = GameObject.FindWithTag("Player").GetComponent <Transform>().position;
 }
Esempio n. 12
0
 void Start()
 {
     if (GameObject.FindGameObjectWithTag("EnemySpawner") != null)
     {
         se = GameObject.FindGameObjectWithTag("EnemySpawner").GetComponent <SpawnEnemy> ();
     }
     shrinkRate = transform.localScale.x / 20.0f;
 }
Esempio n. 13
0
 void SetSpawnMonster()
 {
     foreach (var mon in HeroSystem.GetStageMonster(StageManagement.instance.stageInfo.stageNumber))
     {
         SpawnEnemy spawnEnemy = new SpawnEnemy(PrefabsDatabaseManager.instance.GetMonsterPrefab(mon.id), 1);
         spawnEnemys.Add(spawnEnemy);
     }
 }
Esempio n. 14
0
    public float m_fMagnitude = 0.5f;     // The magnitude.

    void Start()
    {
        m_anim         = GetComponent <Animator>();    // Get the animator component.
        rb             = GetComponent <Rigidbody2D>(); // Get the rigidbody2D component.
        m_enemyHandler = GetComponent <SpawnEnemy>();
        pos            = transform.position;           // The pos vector is set to the position of the enemy.
        m_bDead        = false;                        // Set it to false.
    }
Esempio n. 15
0
	// 스폰할 적의 종류 추가.
	public SpawnEnemy		resisterSpawnEnemy()
	{
		var	spawn = new SpawnEnemy();

		this.spawn_enemies.Add(spawn);

		return(spawn);
	}
Esempio n. 16
0
    // 스폰할 적의 종류 추가.
    public SpawnEnemy               resisterSpawnEnemy()
    {
        var spawn = new SpawnEnemy();

        this.spawn_enemies.Add(spawn);

        return(spawn);
    }
Esempio n. 17
0
 void Start()
 {
     m_anim         = GetComponent <Animator>();    // Get the bosses animator component.
     rb             = GetComponent <Rigidbody2D>(); // Get the bosses rigidbody2D component.
     m_enemyHandler = GetComponent <SpawnEnemy>();  // Get the spawn enemy component.
     pos            = transform.position;           // The position vector is the position of the boss.
     m_bDead        = false;                        // Boss is not dead.
 }
Esempio n. 18
0
 // Start is called before the first frame update
 void Start()
 {
     rb             = GetComponent <Rigidbody2D>();
     m_enemyHandler = GetComponent <SpawnEnemy>();
     m_pos          = transform.position;
     m_bDead        = false;
     m_enemiesLeft  = SpawnEnemy.m_iCurrentEnemyCount;
 }
Esempio n. 19
0
 void Awake()
 {
     checkStart = GameObject.FindGameObjectWithTag("SpawnEnemy").GetComponent <SpawnEnemy>();
     source     = GameObject.FindGameObjectWithTag("SpawnEnemy").GetComponent <AudioSource>();
     button     = this.GetComponent <Button>();
     text       = this.GetComponentInChildren <Text> ();
     text.color = Color.clear;
     fadeTime   = 10.0f;
 }
Esempio n. 20
0
 // Use this for initialization
 void Start()
 {
     Obj                = this;
     isPaused           = false;
     speedScalingFactor = 0.9f;
     enemySpawnSpeed    = currentEnemyMaxSpeed * speedScalingFactor;
     enemiesSpawned     = 0;
     StartCoroutine(Spawner());
 }
Esempio n. 21
0
    // 적을 펑하고 스폰한다(Action, 호스트용)).
    public void             create_enemy_internal()
    {
        // 등록된 적 중에서 랜덤하게 선택.

        if (this.spawn_enemies.Count == 0)
        {
            this.spawn_enemies.Add(new SpawnEnemy());
        }

        float sum = 0.0f;

        foreach (var se in this.spawn_enemies)
        {
            sum += se.frequency;
        }

        SpawnEnemy spawn_enemy = this.spawn_enemies[0];

        float rand = Random.Range(0.0f, sum);

        foreach (var se in this.spawn_enemies)
        {
            rand -= se.frequency;

            if (rand <= 0.0f)
            {
                spawn_enemy = se;
                break;
            }
        }

        //
        dbwin.console().print("Spawn LairName:" + this.name);
        dbwin.console().print("Create enemy:" + spawn_enemy.enemy_name);

        //Debug.Log("Spawn LairName:" + this.name);
        //Debug.Log("Create enemy:" + spawn_enemy.enemy_name);

        chrBehaviorEnemy enemy = LevelControl.get().createCurrentRoomEnemy <chrBehaviorEnemy>(spawn_enemy.enemy_name);

        if (enemy != null)
        {
            enemy.setBehaveKind(spawn_enemy.behave_kind, spawn_enemy.behave_desc);
            enemy.beginSpawn(this.transform.position + Vector3.up * 3.0f, this.transform.forward);

            if (GameRoot.get().isHost())
            {
                // 이 문자열을 함께 게스트에 송신한다.
                string pedigree = enemy.name + "." + spawn_enemy.behave_kind;

                // 원격 송신.
                EnemyRoot.get().RequestSpawnEnemy(this.name, pedigree);

                //Debug.Log(pedigree);
            }
        }
    }
Esempio n. 22
0
    void OnTriggerEnter(Collider obj)
    {
        //string name = obj.gameObject.name;

        if (obj.gameObject.tag == "EnemyBullets")
        {
            Destroy(obj.gameObject);
            live--;
            source.PlayOneShot(hit);
            GameObject[] gameObjectsEnemyBullets = GameObject.FindGameObjectsWithTag("EnemyBullets");

            for (var i = 0; i < gameObjectsEnemyBullets.Length; i++)
            {
                Destroy(gameObjectsEnemyBullets[i]);
            }

            SpawnEnemy enemySpawner = (SpawnEnemy)FindObjectOfType(typeof(SpawnEnemy));
            Destroy(enemySpawner);

            GameObject[] gameObjectsEnemies = GameObject.FindGameObjectsWithTag("Enemies");

            for (var i = 0; i < gameObjectsEnemies.Length; i++)
            {
                Destroy(gameObjectsEnemies[i]);
            }

            shootContinue = false;
            speed         = 0;
            lspeed        = 0;
            lastShootTime = Time.time + 999;
            ultTime       = Time.time + 999;
            savePlayer();
            SceneManager.LoadScene("GameOver");
        }

        if (obj.gameObject.tag == "PowerUp")
        {
            score += (int)Random.value * 20 + 5;
            int temp = (int)(Random.value * 9);
            if (temp % 3 == 0)
            {
                if (bulletPower < 3)
                {
                    bulletPower++;
                }
                else if (ultLeft < 5)
                {
                    ultLeft++;
                }
            }
            else if (ultLeft < 5)
            {
                ultLeft++;
            }
            Destroy(obj.gameObject);
        }
    }
Esempio n. 23
0
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogWarning("Multiple instances of " + this + " found");
        }

        instance = this;
    }
Esempio n. 24
0
 // Start is called before the first frame update
 void Start()
 {
     gm           = GameObject.FindWithTag("GameController").GetComponent <gamaManager>();
     screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z));
     //Debug.Log(screenBounds);
     forward_force = gm.forwardForce;
     //StartCoroutine(CoinsGenerate());
     sm      = GetComponent <SpawnEnemy>();
     sm.coin = a;
 }
Esempio n. 25
0
    void Awake()
    {
        Ins = this;
        //if (!InitGlobalIns()) return;
        GlobalManager.AddToDisabledObjContainer(this);

        SceneManager.sceneLoaded += OnSceneLoaded;
        InspectorEventSignals.OnSpawnEnemyInspectorUpdated += OnSpawnEnemyInspectorUpdated;
        GameEventSignals.OnSceneConfigured += OnSceneConfigured;
    }
Esempio n. 26
0
 // Update is called once per frame
 void Update()
 {
     if (health <= 0)
     {
         Destroy(gameObject);
         SpawnEnemy.DecreaseSpawnedEnemies();
         PlayerController.EnemyIsDead();
         Debug.Log(gameObject.name + " is dead.");
     }
 }
Esempio n. 27
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 28
0
    private void OnDestroy()
    {
        GameObject spawn  = GameObject.FindGameObjectWithTag("EnemySpawnArea");
        SpawnEnemy script = spawn.GetComponent <SpawnEnemy>();
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        if (player == null)
        {
            script.GameOver();
        }
    }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Esempio n. 30
0
 // Use this for initialization
 void Start()
 {
     roundOngoingText.GetComponent <Text> ().text = "No wave ongoing";
     instance           = this;
     lastSpawnTime      = Time.time;
     gameManager        = GameObject.Find("GameManager").GetComponent <GameManager>();
     droneEnemiesList   = new List <GameObject>();
     tankEnemiesList    = new List <GameObject>();
     spiderEnemiesList  = new List <GameObject>();
     outsideEnemiesList = new List <GameObject>();
 }
Esempio n. 31
0
 // Start is called before the first frame update
 void Start()
 {
     player        = GameObject.Find("Player").transform;
     navMesh       = GetComponent <NavMeshAgent>();
     anim          = GetComponent <Animator>();
     health        = GetComponent <EnemyHealth>();
     enemy         = GetComponent <SpawnEnemy>();
     finishedSpawn = false;
     alive         = true;
     StartCoroutine(SpawnAnimation());
 }
Esempio n. 32
0
    void Awake()
    {
        // First we check if there are any other instances conflicting
        if (instance != null && instance != this)
        {
            // If that is the case, we destroy other instances
            Destroy(gameObject);
        }

        // Here we save our singleton instance
        instance = this;

        // Furthermore we make sure that we don't destroy between scenes (this is optional)
        DontDestroyOnLoad(gameObject);
    }
Esempio n. 33
0
 public void UnregisterSpawnPoint(SpawnEnemy spawnPoint)
 {
     mSpawnPoints.Remove(spawnPoint);
 }
Esempio n. 34
0
 public void RegisterSpawnPoint(SpawnEnemy spawnPoint)
 {
     mSpawnPoints.Add(spawnPoint);
 }
Esempio n. 35
0
 void OnLevelWasLoaded(int level)
 {
     readyToEndLevel = false;
     AllWavesSpawned = false;
     //Debug.Log("level: " + levelCount);
     if (level == 1)
     {
         inCombatLevel = true;
         levelCount++;
         waveCount = 1;
         enemySpawner = GameObject.FindGameObjectWithTag("EnemySpawner").GetComponent<SpawnEnemy>();
         Init();
     }
     else
         inCombatLevel = false;
 }