예제 #1
0
파일: HitBox.cs 프로젝트: Gmyth/D.I.V.E.
    protected SingleEffect CreateRandomEffect(Transform targetTransform)
    {
        SingleEffect effect1 = ObjectRecycler.Singleton.GetObject <SingleEffect>(Random.Range(1, 2));

        effect1.transform.position = targetTransform.position - (targetTransform.position - transform.position) * 0.2f;
        effect1.transform.right    = transform.right;
        effect1.setTarget(targetTransform);
        effect1.gameObject.SetActive(true);

        if (effects.Length == 0)
        {
            return(null);
        }


        SingleEffect effect = ObjectRecycler.Singleton.GetObject <SingleEffect>(effects[Random.Range(0, effects.Length)]);

        effect.transform.position   = targetTransform.position - (targetTransform.position - transform.position) * 0.2f;
        effect.transform.right      = transform.right;
        effect.transform.localScale = Vector3.one;
        effect.setTarget(targetTransform);
        effect.gameObject.SetActive(true);


        return(effect);
    }
예제 #2
0
        private void CraftEssenceComboBox_SelectedIndexChanged(object sender, EventArgs e)//从已有列表选择一个礼装
        {
            CraftEssence ce = formMain.memory.getCEWithComboText(((ComboBox)sender).SelectedItem.ToString());

            if (ce == null)
            {
                return;
            }

            CEIDText.Text     = ce.ID.ToString();
            CERarityText.Text = ce.rarity.ToString();
            CECostText.Text   = ce.cost.ToString();
            CEATKText.Text    = ce.ATK.ToString();
            CEHPText.Text     = ce.HP.ToString();


            effectNum[skillNum + 2].Value = ce.getEffectNum();
            for (int i = 0; i < effectNum[skillNum + 2].Value; i++)
            {
                SingleEffect tempEff = ce.getEffect(i);
                effectBox[comboNum * effectMax * (skillNum + 2) + comboNum * i + 0].Text = formMain.targetTypeName[tempEff.targetType];
                effectBox[comboNum * effectMax * (skillNum + 2) + comboNum * i + 1].Text = formMain.effectName[tempEff.type];
                effectText[textNum * effectMax * (skillNum + 2) + textNum * i + 0].Text  = tempEff.value.ToString();
                effectText[textNum * effectMax * (skillNum + 2) + textNum * i + 1].Text  = tempEff.turn.ToString();
                effectText[textNum * effectMax * (skillNum + 2) + textNum * i + 2].Text  = tempEff.fullvalue.ToString();
            }
        }
예제 #3
0
    public SingleEffect GetSingleEffect(int id, Transform target, Vector3 positionOffset)
    {
        SingleEffect effect = GetObject <SingleEffect>(id);

        effect.transform.position   = target.position + positionOffset;
        effect.transform.right      = transform.right;
        effect.transform.localScale = Vector3.one;
        effect.setTarget(target);
        effect.gameObject.SetActive(true);


        return(effect);
    }
예제 #4
0
    public SingleEffect GetSingleEffect(int id, Vector3 position)
    {
        SingleEffect effect = GetObject <SingleEffect>(id);

        effect.transform.position   = position;
        effect.transform.right      = transform.right;
        effect.transform.localScale = Vector3.one;
        effect.setTarget(null);
        effect.gameObject.SetActive(true);


        return(effect);
    }
예제 #5
0
파일: HitBox.cs 프로젝트: Gmyth/D.I.V.E.
    protected SingleEffect CreateEffect(Transform targetTransform, int index = 0)
    {
        if (index < 0 || index >= effects.Length)
        {
            return(null);
        }


        SingleEffect effect = ObjectRecycler.Singleton.GetObject <SingleEffect>(effects[index]);

        effect.transform.position   = targetTransform.position - (targetTransform.position - transform.position) * 0.2f;
        effect.transform.right      = transform.right;
        effect.transform.localScale = Vector3.one;
        effect.setTarget(targetTransform);
        effect.gameObject.SetActive(true);


        return(effect);
    }
예제 #6
0
파일: Bullet.cs 프로젝트: Gmyth/D.I.V.E.
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Ground")
        {
            SingleEffect Hit = ObjectRecycler.Singleton.GetObject <SingleEffect>(4);
            Hit.transform.right      = transform.right;
            Hit.transform.position   = transform.position;
            Hit.transform.localScale = Vector3.one;

            Hit.gameObject.SetActive(true);

            if (!Bounce || bounceCounter > maxBounceTimes)
            {
                numHitsRemaining = 0;
            }
        }
        else if (isFriendly)
        {
            if (other.tag == "Enemy")
            {
                Dummy enemy = other.GetComponent <Dummy>();


                enemy.OnHit?.Invoke(hit, other);


                enemy.ApplyDamage(rawDamage);
                --numHitsRemaining;


                CameraManager.Instance.Shaking(0.20f, 0.05f);
                //TimeManager.Instance.endSlowMotion();
                CameraManager.Instance.Idle();

                SingleEffect hitFx = ObjectRecycler.Singleton.GetObject <SingleEffect>(4);
                hitFx.transform.position   = other.transform.position - (other.transform.position - transform.position) * 0.2f;
                hitFx.transform.right      = transform.right;
                hitFx.transform.position   = other.transform.position + (transform.position - other.transform.position) * 0.5f;
                hitFx.transform.localScale = Vector3.one;

                hitFx.gameObject.SetActive(true);
            }
        }
        else if (other.tag == "Player")
        {
            PlayerCharacter player = other.GetComponent <PlayerCharacter>();

            if (player.State.Index != 6)
            {
                AudioManager.Singleton.PlayOnce("Hit_by_laser");
                //Not in dash, deal damage
                player.ApplyDamage(rawDamage);

                if (hit.knockback > 0)
                {
                    player.KnockbackHorizontal(transform.position, hit.knockback, 0.3f);
                }


                --numHitsRemaining;


                //TimeManager.Instance.endSlowMotion();
                CameraManager.Instance.Idle();

                CameraManager.Instance.Shaking(0.20f, 0.05f);
                SingleEffect Hit = ObjectRecycler.Singleton.GetObject <SingleEffect>(4);
                Hit.transform.right      = transform.right;
                Hit.transform.position   = other.transform.position + (transform.position - other.transform.position) * 0.5f;
                Hit.transform.localScale = Vector3.one;
                Hit.gameObject.SetActive(true);
            }
        }
        else if (other.tag == "PlayerHitBox")
        {
            if (other.name != "DashAtkBox")
            {
                isFriendly = true;
                GetComponent <LinearMovement>().initialPosition = transform.position;
                //GetComponent<LinearMovement>().speed *= 1.5f;
                GetComponent <LinearMovement>().orientation = GetComponent <LinearMovement>().orientation * -1;
                GetComponent <LinearMovement>().spawnTime   = Time.time;

                GetComponent <TrailRenderer>().Clear();

                var spark = ObjectRecycler.Singleton.GetObject <SingleEffect>(23);
                spark.transform.position   = transform.position;
                spark.transform.right      = transform.right;
                spark.transform.localScale = Vector3.one;
                spark.gameObject.SetActive(true);

                transform.right = GetComponent <LinearMovement>().orientation;

                //TimeManager.Instance.endSlowMotion();
                CameraManager.Instance.Idle();
                TimeManager.Instance.startSlowMotion(0.8f);
                CameraManager.Instance.Shaking(0.5f, 0.05f, true);
                CameraManager.Instance.FocusTo(transform.position, 0.02f);

                SingleEffect Hit1 = ObjectRecycler.Singleton.GetObject <SingleEffect>(12);
                Hit1.transform.right    = transform.right;
                Hit1.transform.position = other.transform.position + (transform.position - other.transform.position) * 0.3f;

                Hit1.gameObject.SetActive(true);

                AudioManager.Singleton.PlayOnce("DeflectBullet");
            }
        }


        if (numHitsRemaining <= 0)
        {
            Die();
        }
    }
예제 #7
0
        private void servantComboBox_SelectedIndexChanged(object sender, EventArgs e)//从已有列表选择一个从者
        {
            Servant servant = formMain.memory.getServantWithComboText(((ComboBox)sender).SelectedItem.ToString());

            IDText.Text        = servant.ID.ToString();
            nameText.Text      = servant.name;
            rarityText.Text    = servant.rarity.ToString();
            classComboBox.Text = formMain.className[servant.servantClass];
            costText.Text      = servant.cost.ToString();

            ATKText.Text           = servant.ATK.ToString();
            HPText.Text            = servant.HP.ToString();
            attributeComboBox.Text = formMain.attributeName[servant.attribute];
            npCText.Text           = servant.npCharge.ToString();
            npCdText.Text          = servant.npChargeDEF.ToString();
            starGText.Text         = servant.starGe.ToString();
            starAText.Text         = servant.starAb.ToString();

            colorRHText.Text = servant.redHits.ToString();
            colorBHText.Text = servant.blueHits.ToString();
            colorGHText.Text = servant.greenHits.ToString();
            EXHText.Text     = servant.EXHits.ToString();
            for (int i = 0; i < 5; i++)
            {
                if (i < servant.redCards)
                {
                    colorCard[i].BackColor = Color.Red;
                }
                else if (i < servant.redCards + servant.blueCards)
                {
                    colorCard[i].BackColor = Color.Blue;
                }
                else
                {
                    colorCard[i].BackColor = Color.Green;
                }
            }

            NPtypeComboBox.Text = formMain.cardColorName[servant.NPtype];
            NPdmgText.Text      = servant.NPdmg.ToString();
            NPHitsText.Text     = servant.NPHits.ToString();
            NPtargetText.Text   = servant.NPtarget.ToString();

            effectNum[skillNum + 1].Value = servant.skills[skillNum + 1].getEffectNum();
            for (int i = 0; i < effectNum[skillNum + 1].Value; i++)
            {
                SingleEffect tempEff = servant.skills[skillNum + 1].getEffect(i);
                effectBox[comboNum * effectMax * (skillNum + 1) + comboNum * i + 0].Text = formMain.targetTypeName[tempEff.targetType];
                effectBox[comboNum * effectMax * (skillNum + 1) + comboNum * i + 1].Text = formMain.effectName[tempEff.type];
                effectText[textNum * effectMax * (skillNum + 1) + textNum * i + 0].Text  = tempEff.value.ToString();
                effectText[textNum * effectMax * (skillNum + 1) + textNum * i + 1].Text  = tempEff.turn.ToString();
                effectText[textNum * effectMax * (skillNum + 1) + textNum * i + 2].Text  = tempEff.probability.ToString();
                afterEffectText[i].Text = (tempEff.afterNP == true) ? "1" : "0";
            }

            for (int i = 0; i < skillNum + 1; i++)
            {
                CDText[i].Text     = servant.skills[i].CD.ToString();
                effectNum[i].Value = servant.skills[i].getEffectNum();
                for (int j = 0; j < effectNum[i].Value; j++)
                {
                    SingleEffect tempEff = servant.skills[i].getEffect(j);
                    effectBox[comboNum * effectMax * i + comboNum * j + 0].Text = formMain.targetTypeName[tempEff.targetType];
                    effectBox[comboNum * effectMax * i + comboNum * j + 1].Text = formMain.effectName[tempEff.type];
                    effectText[textNum * effectMax * i + textNum * j + 0].Text  = tempEff.value.ToString();
                    effectText[textNum * effectMax * i + textNum * j + 1].Text  = tempEff.turn.ToString();
                    effectText[textNum * effectMax * i + textNum * j + 2].Text  = tempEff.probability.ToString();
                }
            }
        }