예제 #1
0
 void GetPlayer(int player)
 {
     if (player == 1)
     {
         Player1 = Spawn1.GetComponent <SpawnController>().playerCharacter;
     }
     else
     {
         Player2 = Spawn2.GetComponent <SpawnController>().playerCharacter;
     }
 }
예제 #2
0
    void Start()
    {
        targetpl = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        //target.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, target.transform.position.z);
        GameObject spawn   = GameObject.FindGameObjectWithTag("spawnleft");
        Spawn2     script2 = spawn.GetComponent <Spawn2>();

        enemyHash = script2.enemyId + 1;
        target    = GameObject.Find("Enemy " + script2.enemyId + "(Clone)");
        //Debug.Log(enemyHash);



        //replace 0 with current zombie
    }
예제 #3
0
    void Update()
    {
        if (player1health <= 0)
        {
            Spawn1.GetComponent <SpawnController>().Respawn();
            Player1.GetComponent <PlayerDamage>().health = 100f;
            player1damage = 10f;
            createScore.score2++;
        }

        if (player2health <= 0)
        {
            Player2.GetComponent <PlayerDamage>().health = 100f;
            player2damage = 10f;
            Spawn2.GetComponent <SpawnController>().Respawn();
            Debug.Log("im here");
            //Player2.GetComponent<Rigidbody2D>().position = new Vector2(Spawn2.transform.position.x, Spawn2.transform.position.y);
            createScore.score1++;
        }

        Player1.GetComponent <BulletSpawn>().bulletDamage = player1damage;
        player1health = Player1.GetComponent <PlayerDamage>().health;
        if (Player1.GetComponent <PowerUP>().powerUp)
        {
            PlusDamage(1);
        }
        if (Input.GetKeyDown(KeyCode.E))
        {
            player1damage = 10f;
        }

        Player2.GetComponent <BulletSpawn>().bulletDamage = player2damage;
        player2health = Player2.GetComponent <PlayerDamage>().health;
        if (Player2.GetComponent <PowerUP>().powerUp)
        {
            PlusDamage(2);
        }
        if (Input.GetKeyDown(KeyCode.RightShift))
        {
            player2damage = 10f;
        }


        if (timerScript.currentTime <= 0f)
        {
            EndGame();
        }
    }
예제 #4
0
    public MapTranslator(string path)
    {
        StreamReader sr         = new StreamReader(path);
        int          EnemyCount = 0;
        int          change;

        while (!sr.EndOfStream)
        {
            char[] nextline = sr.ReadLine().ToCharArray();
            change      = nextline[0];
            EnemyCount += change;
            Enemies    += change;

            switch (change)
            {
            case 1:
                Spawn1.Add(EnemyCount);
                break;

            case 2:
                Spawn2.Add(EnemyCount);
                break;

            case 3:
                Spawn3.Add(EnemyCount);
                break;

            case 4:
                Spawn4.Add(EnemyCount);
                break;

            case 5:
                Spawn5.Add(EnemyCount);
                break;

            default:
                break;
            }
        }
    }