コード例 #1
0
    public override void Attack()
    {
        if (!CanAttack() || !currArrow)
        {
            return;
        }

        if (charge < MinCharge)
        {
            Destroy(currArrow.gameObject);
            charge    = 0.0f;
            currArrow = null;
            return;
        }

        AudioManager.Instance.PlaySoundWithParent("arrow_flying", ESoundChannel.SFX, gameObject);

        float t = Interpolation.QuadraticIn(charge);

        currArrow.Impulse            = Mathf.Lerp(MinSpeed, MaxSpeed, t);
        currArrow.LifeTime           = 20f;
        currArrow.Damage             = charge == 1 ? Damage : MinDamage;
        currArrow.Type               = this.Type;
        currArrow.Knockback          = this.Knockback;
        currArrow.RigidbodyKnockback = this.RigidbodyKnockback;
        currArrow.Fire();

        charge    = 0.0f;
        currArrow = null;
    }
コード例 #2
0
ファイル: IceShotSpell.cs プロジェクト: Yunshiyue/ElementGame
    private void Shot()
    {
        //Debug.Log("射出冰箭");
        GameObject iceArrow = poolManager.GetGameObject(spellName);
        IceArrow   script   = iceArrow.GetComponent <IceArrow>();

        script.SetThrower(player);
        Vector2 startDirection = player.transform.position;

        startDirection.x += movementComponent.IsFacingLeft() ? -1 : 1;
        script.SetStartPosition(startDirection);
        script.SetDirection(movementComponent.IsFacingLeft() ? Vector2.left : Vector2.right);
    }
コード例 #3
0
    public override void ReleaseSpell()
    {
        GameObject iceArrow = poolManager.GetGameObject(spellName);
        IceArrow   script   = iceArrow.GetComponent <IceArrow>();

        script.SetThrower(player);
        Vector2 startDirection = player.transform.position;

        startDirection.x += movementComponent.IsFacingLeft() ? -1 : 1;
        script.SetStartPosition(startDirection);
        script.SetMaxExistTime(0.8f);
        script.SetDirection(movementComponent.IsFacingLeft() ? Vector2.left : Vector2.right);
    }
コード例 #4
0
    public override void Charge()
    {
        if (!currArrow)
        {
            currArrow = GameObject.Instantiate(ArrowPrefab, this.transform);
            //currArrow = arrowPool.Create();
            //currArrow.transform.SetParent(this.transform);
        }

        charge += Time.deltaTime / AttackSpeed;
        charge  = Mathf.Min(charge, 1.0f);

        float   t        = Interpolation.CubicOut(charge);
        Vector3 arrowPos = Interpolation.BezierCurve(this.transform.position, ChargedArrowPos.position, t);

        currArrow.transform.position = arrowPos;
    }
コード例 #5
0
ファイル: AmazonSkill.cs プロジェクト: hanjons/SkillTree
        private void AmazonSkill_VisibleChanged(object sender, EventArgs e)
        {
            MagicArrow.SetSkillPoints     = "0";
            FireArrow.SetSkillPoints      = "0";
            ColdArrow.SetSkillPoints      = "0";
            MultyArrow.SetSkillPoints     = "0";
            ExplodingArrow.SetSkillPoints = "0";
            IceArrow.SetSkillPoints       = "0";
            GuideArrow.SetSkillPoints     = "0";
            FireWallArrow.SetSkillPoints  = "0";
            SplitArrow.SetSkillPoints     = "0";
            FrozenArrow.SetSkillPoints    = "0";

            MagicArrow.setTextBoxColor();
            FireArrow.setTextBoxColor();
            ColdArrow.setTextBoxColor();
            MultyArrow.setTextBoxColor();
            ExplodingArrow.setTextBoxColor();
            IceArrow.setTextBoxColor();
            GuideArrow.setTextBoxColor();
            FireWallArrow.setTextBoxColor();
            SplitArrow.setTextBoxColor();
            FrozenArrow.setTextBoxColor();
        }