Esempio n. 1
0
 public void TakeDamageEnemy(int p_damage, int p_actor)
 {
     if (photonView.IsMine)
     {
         Health -= p_damage;
         Debug.Log(Health);
         if (Health <= 0)
         {
             level1.isStopped = true;
             animation1.SetBool("RunNo", true);
             animation1.SetBool("RunYes", false);
             animation1.SetBool("ShootYes", false);
             animation1.SetBool("DieYes", true);
             body2.enabled = false;
             if (p_actor >= 0)
             {
                 if (photonView.IsMine)
                 {
                     manager.ChangeStat_S(p_actor, 0, 1);
                     manager.ChangeStat_S(p_actor, 2, 1);
                 }
             }
             //  PhotonNetwork.Destroy(bullet);
             if (photonView.IsMine)
             {
                 PhotonNetwork.Destroy(gameObject);// PhotonNetwork.Destroy(gameObject);
             }
             //   PhotonNetwork.Destroy(Enemy);
         }
     }
 }
Esempio n. 2
0
    public void TakeDamageEnemy(int p_damage, int p_actor)
    {
        if (photonView.IsMine)
        {
            Health2 -= p_damage;
            Debug.Log(Health2);

            if (Health2 <= 0)
            {
                level2.isStopped = true;
                animation1.SetBool("RunFalse", true);
                animation1.SetBool("RunTrue", false);
                animation1.SetBool("DieTrue", true);
                body.enabled = false;
                if (p_actor >= 0)
                {
                    if (photonView.IsMine)
                    {
                        manager.ChangeStat_S(p_actor, 0, 1);
                        manager.ChangeStat_S(p_actor, 2, 1);
                    }
                }
                if (photonView.IsMine)
                {
                    PhotonNetwork.Destroy(enemy);
                }
            }
        }
    }
Esempio n. 3
0
 public void TakeDamage(int p_damage, int p_actor)
 {
     if (photonView.IsMine)
     {
         if (current_armor > 0)
         {
             current_armor -= p_damage;
             Debug.Log(current_armor);
             RefreshArmorBar();
         }
         else
         {
             current_health -= p_damage;
             RefreshHealthBar();
         }
         if (current_health <= 0)
         {
             manager.Spawn();
             manager.ChangeStat_S(PhotonNetwork.LocalPlayer.ActorNumber, 1, 1);
             if (p_actor >= 0)
             {
                 manager.ChangeStat_S(p_actor, 0, 1);
             }
             PhotonNetwork.Destroy(gameObject);
         }
     }
 }
Esempio n. 4
0
 void Update()
 {
     cntd   = GameObject.Find("HUD").transform.Find("Countdown").transform;
     t_wave = GameObject.Find("HUD/Waves/Text").GetComponent <Text>();
     if (PhotonNetwork.IsMasterClient)
     {
         if (Input.GetKeyDown(KeyCode.O))
         {
             start = true;
         }
     }
     if (PhotonNetwork.CountOfPlayersInRooms == 2 || start)
     {
         cntd.gameObject.SetActive(true);
         t_countdwn      = GameObject.Find("HUD/Countdown/Text").GetComponent <Text>();
         currenttime    -= Time.deltaTime;
         t_countdwn.text = currenttime.ToString("0");
         if (currenttime <= 0)
         {
             currenttime = 0;
             cntd.gameObject.SetActive(false);
             if (state == SpawnState.WAITING)
             {
                 if (!EnemyAlive())
                 {
                     // t_wave.text = o + " Wave";
                     byte b = (byte)o;
                     manager.ChangeStat_S(PhotonNetwork.LocalPlayer.ActorNumber, 4, b);
                     WaveCompleted();
                     // Debug.LogError("VEIKIA");
                     // return;
                     o++;
                 }
                 else
                 {
                     return;
                 }
             }
             if (waveCntdwn <= 0)
             {
                 if (state != SpawnState.SPAWNING)
                 {
                     StartCoroutine(SpawnWave(waves[nextwave]));
                 }
             }
             else
             {
                 waveCntdwn -= Time.deltaTime;
             }
         }
     }
 }