Exemplo n.º 1
0
 public void NetInitHP(int _HP)//принимаем сколько у нас здоровья
 {
     if (photonView.isMine)
     {
         HPBarController.InitHP(_HP);//инит шкалу здоровья
     }
 }
Exemplo n.º 2
0
    IEnumerator Start()
    {
        yield return(new WaitForSeconds(0.5f));

        hpbc = GameObject.Find("HPController").GetComponent <HPBarController>();

        while (true)
        {
            if ((hpbc.rehp() * 100 / hp) > 50)
            {
                //Ai1
                Instantiate(bullets1, gameObject.transform.position, Quaternion.identity);
                yield return(new WaitForSeconds(2.5f));

                Instantiate(bullets1_, gameObject.transform.position, Quaternion.identity);
                yield return(new WaitForSeconds(2.6f));
            }

            //Ai2
            else
            {
                Instantiate(bullets2, gameObject.transform.position, Quaternion.identity);
                yield return(new WaitForSeconds(5.0f));

                Instantiate(bullets2_, gameObject.transform.position, Quaternion.identity);
                yield return(new WaitForSeconds(2.0f));

                Instantiate(bullets3, gameObject.transform.position, Quaternion.identity);
                yield return(new WaitForSeconds(1.5f));
            }
        }
    }
Exemplo n.º 3
0
 protected virtual void Start()
 {
     DotResp       = transform.position;//запишем точку респы
     ch_controller = GetComponent <CharacterController>();
     ch_animator   = GetComponent <Animator>();
     canMove       = true;
     HP            = maxHP;
     HPBarController.InitHP(HP);                                                    //инит шкалу здоровья
     EffectDamage = transform.Find("DamageEffect").GetComponent <ParticleSystem>(); //инит эффект урона
     EffectDrift  = transform.Find("DriftEffect").GetComponent <ParticleSystem>();  //инит эффект урона
     EffectDead   = transform.Find("DeadEffect").gameObject;                        //инит эффект смерти
     //  EffectHill = transform.Find("HillEffect").GetComponent<ParticleSystem>();//инит эффект хила
     Kills    = 0;
     Deads    = 0;
     MyKiller = null;
     if (photonView.isMine)//отошлем всем остальным мое имя одежду и оружие
     {
         if (PlayerPrefs.GetString("Name") != null || PlayerPrefs.GetString("Name") != "")
         {
             Name = PlayerPrefs.GetString("Name");
         }
         photonView.RPC("ReciveNameNewPlayer", PhotonTargets.OthersBuffered, Name); //отправляем всем мое имя
         if (PlayerPrefs.GetInt("PigWeapon") != 0)                                  //отправим мое оружие
         {
             photonView.RPC("ReciveWeaponNewPlayer", PhotonTargets.AllBuffered, PlayerPrefs.GetInt("PigWeapon"));
         }
         if (PlayerPrefs.GetInt("PigDress") != 0)//отправим мою одежду
         {
             photonView.RPC("ReciveDressNewPlayer", PhotonTargets.AllBuffered, PlayerPrefs.GetInt("PigDress"));
         }
     }
 }
Exemplo n.º 4
0
    protected virtual void Start()
    {
        DotResp       = transform.position;//запишем точку респы
        ch_controller = GetComponent <CharacterController>();
        ch_animator   = GetComponent <Animator>();
        canMove       = true;
        HP            = maxHP;
        HPBarController.InitHP(HP);                                                    //инит шкалу здоровья
        EffectDamage = transform.Find("DamageEffect").GetComponent <ParticleSystem>(); //инит эффект урона
        EffectDrift  = transform.Find("DriftEffect").GetComponent <ParticleSystem>();  //инит эффект урона
        EffectDead   = transform.Find("DeadEffect").gameObject;                        //инит эффект смерти
                                                                                       //  EffectHill = transform.Find("HillEffect").GetComponent<ParticleSystem>();//инит эффект хила
        Kills    = 0;
        Deads    = 0;
        MyKiller = null;

        if (PlayerPrefs.GetString("Name") != null || PlayerPrefs.GetString("Name") != "")
        {
            Name = PlayerPrefs.GetString("Name");                                                             //ставим мне имя
        }
        if (PlayerPrefs.GetInt("PigWeapon") != 0)                                                             //мое оружие
        {
            DressAndWeapon.IDprimerka = 0;                                                                    //сообщаем генератору одежды что мы были голенькие
            DressAndWeapon.SwapWeapon(new GameObject[] { this.gameObject }, PlayerPrefs.GetInt("PigWeapon")); //переодеваем
            Damage = Damage + DressAndWeapon.WeaponList[PlayerPrefs.GetInt("PigWeapon")].DamageInc;           //прибавляем к урону оружие
        }
        if (PlayerPrefs.GetInt("PigDress") != 0)                                                              //мою одежду
        {
            DressAndWeapon.IDprimerka = 0;                                                                    //сообщаем генератору одежды что мы были голенькие
            DressAndWeapon.SwapDress(new GameObject[] { this.gameObject }, PlayerPrefs.GetInt("PigDress"));   //переодеваем
        }
    }
Exemplo n.º 5
0
    public void TakeDamageOrHill(int damageOrHill, GameObject fromGO, bool kicked = false)//получение урона или хил
    {
        if (ch_animator.GetInteger("dead") != 0)
        {
            return;                                     //мертвых ьить низя
        }
        if (damageOrHill < 0)
        {
            int r = Random.Range(1, 4);
            switch (r)
            {
            case 1:
            {
                GetComponent <AudioController>().PlaySound(TypePig + "ai", 0.4f);
                break;
            }

            case 2:
            {
                GetComponent <AudioController>().PlaySound(TypePig + "oi", 0.4f);
                break;
            }

            case 3:
            {
                GetComponent <AudioController>().PlaySound(TypePig + "auch", 0.4f);
                break;
            }
            }
        }//звук боли
        if (damageOrHill < 0 && (!kicked || (kicked && HP < 1)))
        {
            EffectDamage.Play();                                                     //если пришел урон(и не откидывает) - эффект урона''или если с пинка дохнем
        }
        HP = HP + damageOrHill;
        if (HP <= 0)//дохнем
        {
            HP       = 0;
            MyKiller = fromGO;                                      //запомним убийцу
            Deads++;                                                //увеличим счетчик смертей
            KillsSeries = 0;                                        //обнулим серию убийств
            Dead();
            fromGO.gameObject.GetComponent <IPig>().KillsCounter(); //увеличим счетчик убийств у вражины
            if (!LevelController.FB)                                //если это первая смерть
            {
                LevelController.FB = true;                          //мы пролюбили возможность сделать ФБ
            }
        }
        else if (kicked)//микростан и откидываем если получили несмертельный урон
        {
            Stunned(fromGO.transform.position, fromGO.GetComponent <BOTCONTROL>().StunPower);
        }
        if (HP > maxHP)
        {
            HP = maxHP;
        }
        HPBarController.InitHP(HP);//инит шкалу здоровья
    }
Exemplo n.º 6
0
    IEnumerator Start()
    {
        yield return(new WaitForSeconds(0.5f));

        hpbc   = GameObject.Find("HPController").GetComponent <HPBarController>();
        rbody  = GetComponent <Rigidbody2D>();
        speed  = 1.0f;
        radius = 1f;
        posY   = transform.position.y;

        while (true)
        {
            yield return(new WaitForSeconds(0.01f));


            if (isLRAttack)
            {
                continue;
            }


            if (hpbc.rehp() <= 900)
            {
                baseDir = Random.Range(0, 4);
            }
            //Ai1

            if (baseDir < 2)
            {
                yield return(BaseBullet());
            }

            if (isSAttack)
            {
                continue;
            }

            if (baseDir == 2 && !SAttackFlag)
            {
                SAttackFlag = true;
                yield return(StltAttack());
            }
            else
            {
                yield return(BaseBullet());
            }


            if (baseDir == 3)
            {
                yield return(LrotAttack());

                SAttackFlag = false;
            }
        }
    }
Exemplo n.º 7
0
    private double bulletStartCount = 0f; //今のパターンの弾幕が始まってから何秒経過したか(弾幕ループ時リセット)

    private void Start()
    {
        alertImage = alertImageObj.GetComponent <RectTransform>();

        hp = hpController.GetComponent <HPBarController>();

        alertImageObj.SetActive(false);

        bulletsOya = GameObject.Find("bulletsOya");
    }
Exemplo n.º 8
0
 public void Rise()               //воскресни!
 {
     EffectDead.SetActive(false); //выключ эффект смерти
     tDead              = 0;
     canMove            = true;
     HP                 = maxHP;
     transform.position = DotResp; //на респу!
     ch_animator.SetInteger("dead", 0);
     HPBarController.InitHP(HP);   //инит шкалу здоровья
     ch_controller.enabled = true; //выключаем контроллер
 }
Exemplo n.º 9
0
 // Use this for initialization
 void Awake()
 {
     _instance     = this;
     _animator     = GetComponent <Animator>();
     _movement     = GetComponent <Player_Movement>();
     _input        = GetComponent <Player_InputController>();
     _hp           = _OriginalHP;
     _transform    = GetComponent <Transform>();
     _cameraFollow = FindObjectOfType <Player_CameraFollow>();
     _hpBar        = FindObjectOfType <HPBarController>();
     _hammer       = GetComponent <Weapon_Hammer>();
 }
Exemplo n.º 10
0
    public HPBarController GetFromPool()
    {
        for (int i = 0; i < HPBarList.Count; i++)
        {
            if (!HPBarList[i].gameObject.activeInHierarchy)
            {
                return(HPBarList[i]);
            }
        }
        HPBarController temp = Instantiate(HPBar);

        temp.transform.SetParent(Canvas);
        temp.transform.localScale = Vector3.one;
        HPBarList.Add(temp);
        return(temp);
    }
Exemplo n.º 11
0
    IEnumerator Start()
    {
        hpslider = GameObject.Find("Slider").GetComponent <Slider>();
        StartCoroutine(idou());
        stageJudge = 1;
        yield return(new WaitForSeconds(0.5f));

        hpbc = GameObject.Find("HPController").GetComponent <HPBarController>();
        int count = count_max;

        yield return(StartCoroutine(Wave1()));

        yield return(StartCoroutine(Wave2()));

        yield return(StartCoroutine(Wave3()));
    }
 public void Hit(double value)
 {
     Debug.Log("hit damage : " + value.ToString());
     currentHP -= value;
     if (hpbar == null || !hpbar.gameObject.activeInHierarchy)
     {
         hpbar = control.GetHPBar();
         hpbar.gameObject.SetActive(true);
     }
     hpbar.transform.position = HPBarPos.position;
     if (currentHP <= 0 && !anim.GetBool(AnimationHashList.AnimHashDead))
     {
         anim.SetBool(AnimationHashList.AnimHashDead, true);
         rb.velocity = Vector2.zero;
         StartCoroutine(Hide());
         hpbar.ShowIncome(control.EarnMoney().ToString("N1"));
     }
     else
     {
         hpbar.SetHP((float)(currentHP / maxHP));
     }
 }
Exemplo n.º 13
0
 void Start()
 {
     //hpbcの取得
     hpbc = GameObject.Find("HPController").GetComponent <HPBarController>();
 }
Exemplo n.º 14
0
    public void TakeDamageOrHill(int damageOrHill, GameObject fromGO, bool kicked = false) //получение урона или хил
    {
        if (ch_animator.GetInteger("dead") != 0)
        {
            return;                                     //мертвых ьить низя
        }
        if (damageOrHill < 0)
        {
            int r = Random.Range(1, 4);
            switch (r)
            {
            case 1:
            {
                GetComponent <AudioController>().PlaySound(TypePig + "ai", 0.4f);
                break;
            }

            case 2:
            {
                GetComponent <AudioController>().PlaySound(TypePig + "oi", 0.4f);
                break;
            }

            case 3:
            {
                GetComponent <AudioController>().PlaySound(TypePig + "auch", 0.4f);
                break;
            }
            }
        }    //звук боли
        if (damageOrHill < 0 && (!kicked || (kicked && HP < 1)))
        {
            EffectDamage.Play();                                                         //если пришел урон(и не откидывает) - эффект урона''или если с пинка дохнем
        }
        if (PhotonNetwork.isMasterClient)
        {
            HP = HP + damageOrHill;
            if (HP <= 0)    //дохнем
            {
                HP = 0;

                MyKiller = fromGO;                                                                                               //запомним убийцу
                photonView.RPC("InputStatsFromMasterIdKiller", PhotonTargets.Others, fromGO.GetComponent <PhotonView>().viewID); //передадим убийцу
                if (fromGO.GetComponent <NETPIG>().MyKiller == this.gameObject)                                                  //если мне отомстили
                {
                    fromGO.GetComponent <PhotonView>().RPC("Revenge", PhotonTargets.All);                                        //месть!
                }
                Deads++;                                                                                                         //увеличим счетчик смертей
                KillsSeries = 0;                                                                                                 //обнулим серию убийств
                photonView.RPC("InputStatsFromMasterDeads", PhotonTargets.Others, Deads);                                        //передаем счетчик смертей
                fromGO.gameObject.GetComponent <IPig>().KillsCounter();                                                          //увеличим счетчик убийств у вражины
                photonView.RPC("Dead", PhotonTargets.All);                                                                       // Dead();
                if (!LevelController.FB)                                                                                         //если это первая смерть
                {
                    fromGO.GetComponent <PhotonView>().RPC("FirstBlood", PhotonTargets.All);
                }
            }
            else if (kicked)    //микростан и откидываем если получили несмертельный урон
            {
                photonView.RPC("Stunned", PhotonTargets.All, fromGO.transform.position, fromGO.GetComponent <NETPIG>().StunPower);
            }
            if (HP > maxHP)
            {
                HP = maxHP;
            }

            if (photonView.isMine)
            {
                HPBarController.InitHP(HP);    //инит шкалу здоровья
            }
            else
            {
                photonView.RPC("NetInitHP", PhotonTargets.All, HP);    //инит шкалу удаленно
            }
        }
    }
Exemplo n.º 15
0
    IEnumerator Start()
    {
        yield return(new WaitForSeconds(0.5f));

        hpbc = GameObject.Find("HPController").GetComponent <HPBarController>();
        int    count = count_max;
        GetAim ga    = new GetAim();

        while (true)
        {
            yield return(new WaitForSeconds(0.5f));

            baseDir = Random.Range(0, 2);
            //Ai1
            Instantiate(ballets1_3, gameObject.transform.position, Quaternion.identity);
            yield return(new WaitForSeconds(0.4f));

            Instantiate(ballets1_4, gameObject.transform.position, Quaternion.identity);
            yield return(new WaitForSeconds(0.4f));

            if (GameObject.Find("player") != null)
            {
                Instantiate(ballets1_5, gameObject.transform.position, ga.getAimQua(gameObject.transform.position, GameObject.Find("player").transform.position));
            }
            if (reset == 1)
            {
                count = 0;
            }
            if (count <= 0)
            {
                if (i == 0)
                {
                    yield return(new WaitForSeconds(0.8f));

                    i = 1;
                    Instantiate(enemy1, new Vector3(-2.0f, 5.0f, 0.0f), Quaternion.identity);
                    if (reset == 1)
                    {
                        Instantiate(ballets2_1, gameObject.transform.position, Quaternion.identity);
                        reset = 0;
                    }
                }
                else
                {
                    yield return(new WaitForSeconds(0.8f));

                    i = 0;
                    Instantiate(enemy1, new Vector3(2.0f, 5.0f, 0.0f), Quaternion.identity);
                    if (reset == 1)
                    {
                        Instantiate(ballets2_2, gameObject.transform.position, Quaternion.identity);
                        reset = 0;
                    }
                }
                count = count_max;
            }
            yield return(new WaitForSeconds(1.0f));

            count--;
        }
    }
Exemplo n.º 16
0
 void updatehealthbar(HPBarController hpBar, float hpFrom, float hpTo)
 {
     hpBar.AnimateHP(hpFrom, hpTo);
 }