Esempio n. 1
0
    protected void Start()
    {
        AudioPlayer audio = GameObject.Find("AudioList").GetComponent <AudioPlayer>();

        if (AudioIndex != -1 && audio != null)
        {
            audio.Play(AudioIndex);
        }

        //
        damege = GetComponent <Damege>();
        chara  = GetComponentInParent <Charactor>();
        this.transform.parent = null;
        if (damege.type == 1)
        {
            //打撃なら
            //このオブジェクトを発生源の子にする
            if (chara != null)
            {
                this.transform.parent = chara.gameObject.transform;
            }
        }
        if (chara != null)
        {
            isRight = chara.IsRight;
        }
        hit_col = GetComponent <Collider2D>();
    }
Esempio n. 2
0
 //やられ接触判定
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.tag == "enemy")
     {
         Damege d1 = refObj.GetComponent <Damege>();
         d1.DamegeFlag(true);
     }
 }
Esempio n. 3
0
    public void Hit(BigInteger damege)
    {
        anim_Monster.Play("hit");

        BigInteger total_damege = 0;
        int        Rd           = UnityEngine.Random.Range(0, 100);

        Transform pos = UiManager.instance.obj_Stage.transform;

        switch (PlayManager.instance.Stage_State)
        {
        case Stage_State.stage:
            pos = UiManager.instance.obj_Stage.transform;
            break;

        case Stage_State.underground:
            pos = UiManager.instance.UndergroundDungeon.transform;
            break;

        case Stage_State.upgrade:
            pos = UiManager.instance.UpgradeDungeon.transform;
            break;

        case Stage_State.hell:
            pos = UiManager.instance.HellDungeon.transform;
            break;

        default:
            break;
        }

        if (Player_stat.int_Critical_Percent >= Rd)
        {
            total_damege = damege + (damege * (BigInteger)Player_stat.int_Critical_Damege / 100);

            Damege sc_damege = Instantiate(UiManager.instance.txt_Critical_Damege, pos).GetComponent <Damege>();
            sc_damege.transform.position = this.transform.position;
            sc_damege.Set_Txt(total_damege);
        }
        else
        {
            total_damege = damege;

            Damege sc_damege = Instantiate(UiManager.instance.txt_Damege, pos).GetComponent <Damege>();
            sc_damege.transform.position = this.transform.position;
            sc_damege.Set_Txt(total_damege);
        }

        hp -= total_damege;

        //slider_Hp.maxValue = total_Hp;
        slider_Hp.value = (float)Math.Exp(BigInteger.Log(hp) - BigInteger.Log(total_Hp));

        if (hp <= 0)
        {
            StartCoroutine("Co_Die");
        }
    }
Esempio n. 4
0
 void _battle_DamagedEvent(object sender, DamageEventArgs args)
 {
     if (args.Target == Current)
     {
         if (args.Damage == 0)
         {
             Damege.Show(CurrentDamage, "Miss");
             return;
         }
         Damege.Show(CurrentDamage, args.Damage.ToString());
         CurrentImage.Damaged();
         if (args.IsCritical)
         {
             Flash.Show(this);
             MagicCircle.Show(this, 500);
             CutInFace.Show(this, new NameModelViewModel().Hissatsu, Enemy.MainName, false, 2);
             DependencyService.Get <IDeviceService>().PlayVibrate();
         }
         else if (MyRandom.GetRandom(10) > 3)
         {
             BattleComment.Show(BattleCommentAreaForCurrent, Current.GetBattleComment());
         }
     }
     else
     {
         if (args.Damage == 0)
         {
             Damege.Show(EnemyDamage, "Miss");
             return;
         }
         Damege.Show(EnemyDamage, args.Damage.ToString());
         EnemyImage.Damaged();
         if (args.IsCritical)
         {
             Flash.Show(this);
             MagicCircle.Show(this, 500);
             CutInFace.Show(this, new NameModelViewModel().Hissatsu, Current.MainName, true, 2);
             DependencyService.Get <IDeviceService>().PlayVibrate();
         }
         else if (MyRandom.GetRandom(10) > 3)
         {
             BattleComment.Show(BattleCommentAreaForEnemy, Enemy.GetBattleComment());
         }
     }
 }
Esempio n. 5
0
 private void Awake()
 {
     damege = new Damege();
 }
Esempio n. 6
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (CheckTagForTrigger(col))
        {
            //コーラーの被ダメ判定をtrueにする
            caller.AttackHit = true;//問題はいつfalseにするか
            //被ダメ処理
            GameObject objop = col.gameObject;
            damege = objop.GetComponent <Damege>();
            //ダメージの数値分だけHPを減らす
            //ReduceHealth(damege.value);
            HitBox hitbox = objop.GetComponent <HitBox>();


            if (nowflag.IsAbleToBeDameged && !Invisible && (tmp_col != col))
            {
                tmp_col    = col;
                status.HP -= damege.value;
                //自身がプレイヤーならMPを回収する
                if (hitbox.chara != null)
                {
                    hitbox.chara.RecoverMP(hitbox.MPRecover);
                }
            }
            //ダメージ処理
            //(プレイヤーの向きを加味したい)
            bool isHitBoxRight = hitbox.isRight;
            //プレイヤーの向きによって吹っ飛びの向きを分岐
            //↑キャラクタの向きによって吹っ飛びの向きが違うのはおかしいのでは?
            Vector2 AdjustedDamegeVector;
            AdjustedDamegeVector = damege.vector;


            if (!isHitBoxRight)
            {
                AdjustedDamegeVector.x *= -1;
            }

            //無敵状態でなければ
            if (nowflag.IsAbleToBeClashed && !Invisible && !hitbox.IsHit)
            {
                //強靭度条件を満たしていたら
                if (col.tag == "PlayerAttack" && tag == E_Tag.Enemy)
                {
                    E_ModeBase e_mode = (E_ModeBase)GetComponent <TestEnemy>().Mode;
                    if (damege.Strength > e_mode.Strength + status.level)
                    {
                        //つかみかそうでないか
                        if (!hitbox.isGrip)
                        {
                            //HitBoxのColliderより先にこっちが呼ばれていたらIsHitを弄る
                            hitbox.IsHit = true;

                            //実際に吹っ飛ぶ
                            audioPlayer.Play(4);
                            Clash(AdjustedDamegeVector, damege.power, damege.speed);
                        }
                        else
                        {
                            //キャラクターは掴まれる
                            Grip = hitbox;
                            ChangeMode(6);
                        }
                    }
                    else
                    {
                        //ボスならば反撃する
                        if (IsBoss)
                        {
                            Boss b = (Boss)this;
                            if (modetime > 1.0 && b.IsCounter)
                            {
                                ChangeMode(7);
                            }
                        }
                    }
                }
                else
                {
                    //HitBoxのColliderより先にこっちが呼ばれていたらIsHitを弄る
                    hitbox.IsHit = true;


                    //実際に吹っ飛ぶ
                    Clash(AdjustedDamegeVector, damege.power, damege.speed);
                }
                //喰らいエフェクトの表示
                if (damege.Effect != null)
                {
                    GameObject ef = GameObject.Instantiate(damege.Effect);
                    ef.transform.position = transform.position;
                    damege.Effect         = null;
                }
            }
        }
    }