Beispiel #1
0
    //激活该主元素,同时制定两个辅助元素
    public void Activate(ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
    {
        isActive = true;
        //把风主元素本身需要的资源激活
        windShortSpell.Enable();
        //把指定辅助技能所需要的资源激活

        //飓风
        hurricaneSpell.Enable();
        //风场
        windFieldSpell.Enable();


        if (aElement == ElementAbilityManager.Element.Fire || bElement == ElementAbilityManager.Element.Fire)
        {
            blinkBackSpell.Enable();
        }
        //风箭
        if (aElement == ElementAbilityManager.Element.Ice || bElement == ElementAbilityManager.Element.Ice)
        {
            windArrowSpell.Enable();
        }
        if (aElement == ElementAbilityManager.Element.Thunder || bElement == ElementAbilityManager.Element.Thunder)
        {
            windThunderSpell.Enable();
        }
    }
Beispiel #2
0
 public void FullySpell(ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
 {
     if (aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.NULL)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             hurricaneSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Fire && bElement == ElementAbilityManager.Element.NULL ||
              aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Fire)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             blinkBackSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Ice && bElement == ElementAbilityManager.Element.NULL ||
              aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Ice)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             windArrowSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Thunder && bElement == ElementAbilityManager.Element.NULL ||
              aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Thunder)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityNeedControl))
         {
             windThunderSpell.SetTargetPosition(GetSightHeadPosition());
             windThunderSpell.Cast();
         }
     }
 }
 public void FullySpell(ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
 {
     if (aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.NULL)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             thunderLongSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Fire && bElement == ElementAbilityManager.Element.NULL ||
              aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Fire)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             thunderLinkSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Ice && bElement == ElementAbilityManager.Element.NULL ||
              aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Ice)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             thunderIceSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Wind && bElement == ElementAbilityManager.Element.NULL ||
              aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Wind)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             isInThunderWind = true;
             thunderCircleScript.ExpendCircle();
         }
     }
 }
Beispiel #4
0
    //public readonly int MAX_ICE_EXIST_NUMBER = 32;
    //private LinkedList<int> freeClockArrayElement = new LinkedList<int>();
    //private


    //激活该主元素,同时制定两个辅助元素
    public void Activate(ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
    {
        //把冰主元素本身需要的资源激活

        this.isOn = true;
        iceShieldSpell.Enable();
        iceSwordSpell.Enable();
        iceArrowSpell.Enable();
        iceHealSpell.Enable();
        //把指定辅助技能所需要的资源激活

        //水盾
        if (aElement == ElementAbilityManager.Element.Fire || bElement == ElementAbilityManager.Element.Fire)
        {
            waterShieldSpell.Enable();
        }
        if (aElement == ElementAbilityManager.Element.Thunder || bElement == ElementAbilityManager.Element.Thunder)
        {
            iceThunderSpell.Enable();
        }
        if (aElement == ElementAbilityManager.Element.Wind || bElement == ElementAbilityManager.Element.Wind)
        {
            iceBlinkSpell.Enable();
            iceShotSpell.Enable();
        }
    }
Beispiel #5
0
 public void FullySpell(ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
 {
     if (aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.NULL)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             meteoriteSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Thunder && bElement == ElementAbilityManager.Element.NULL ||
              aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Thunder)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             fireThunderSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Ice && bElement == ElementAbilityManager.Element.NULL ||
              aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Ice)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             protectiveFireBallSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Wind && bElement == ElementAbilityManager.Element.NULL ||
              aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Wind)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             rocketPackSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Thunder && bElement == ElementAbilityManager.Element.Wind ||
              aElement == ElementAbilityManager.Element.Wind && bElement == ElementAbilityManager.Element.Thunder)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             lavaSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Ice && bElement == ElementAbilityManager.Element.Wind ||
              aElement == ElementAbilityManager.Element.Wind && bElement == ElementAbilityManager.Element.Ice)
     {
         if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             meteorShowerSpell.Cast();
         }
     }
     else if (aElement == ElementAbilityManager.Element.Ice && bElement == ElementAbilityManager.Element.Thunder ||
              aElement == ElementAbilityManager.Element.Thunder && bElement == ElementAbilityManager.Element.Ice)
     {
         if (movementComponent.RequestChangeControlStatus(SelfExplosionAttack.SELF_EXPLOSION__TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
         {
             selfExplosionSpell.Cast();
         }
     }
 }
Beispiel #6
0
 public bool Casting(bool isFullySpelt, ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
 {
     if (movementComponent.RequestChangeControlStatus(0f, MovementPlayer.PlayerControlStatus.Casting))
     {
         isCurCasting = true;
         return(true);
     }
     return(false);
 }
Beispiel #7
0
    /// <summary>
    /// 切换元素
    /// </summary>
    /// <param name="main">主元素</param>
    /// <param name="a">A元素</param>
    /// <param name="b">B元素</param>
    public void Switch(ElementAbilityManager.Element main, ElementAbilityManager.Element a, ElementAbilityManager.Element b)
    {
        //元素更换
        mainElement.overrideSprite = elements[main];
        aElement.overrideSprite    = elements[a];
        bElement.overrideSprite    = elements[b];

        //Debug.Log("切换元素");
    }
Beispiel #8
0
    public void FullySpell(ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
    {
        if (aElement == ElementAbilityManager.Element.Fire && bElement == ElementAbilityManager.Element.NULL ||
            aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Fire)
        {
            if (movementComponent.RequestChangeControlStatus(ElementAbilityManager.DEFALT_CASTING_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
            {
                waterShieldSpell.Cast();
            }
        }
        else if (aElement == ElementAbilityManager.Element.Thunder && bElement == ElementAbilityManager.Element.NULL ||
                 aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Thunder)
        {
            if (movementComponent.RequestChangeControlStatus(IceThunderSpell.ICE_THUNDER_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
            {
                iceThunderSpell.Cast();
            }
        }

        else if (aElement == ElementAbilityManager.Element.Wind && bElement == ElementAbilityManager.Element.NULL ||
                 aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.Wind)
        {
            if (movementComponent.RequestChangeControlStatus(IceShieldMashSpell.ICE_SHIELD_TIME, MovementPlayer.PlayerControlStatus.AbilityWithMovement))
            {
                switch (weapon)
                {
                case IceWeapon.Sword:
                    iceBlinkSpell.Cast();
                    break;

                case IceWeapon.Arrow:
                    iceShotSpell.Cast();
                    break;

                case IceWeapon.Shield:
                    iceSheildMashSpell.Cast();
                    break;
                }
            }
        }
    }
Beispiel #9
0
    //激活该主元素,同时制定两个辅助元素
    public void Activate(ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
    {
        //把火主元素本身需要的资源激活
        isOn = true;

        //把指定技能所需要的资源激活

        fireBallSpell.Enable();
        meteoriteSpell.Enable();

        //
        if (aElement == ElementAbilityManager.Element.Thunder || bElement == ElementAbilityManager.Element.Thunder)
        {
            fireThunderSpell.Enable();
        }
        if (aElement == ElementAbilityManager.Element.Ice || bElement == ElementAbilityManager.Element.Ice)
        {
            protectiveFireBallSpell.Enable();
        }
        if (aElement == ElementAbilityManager.Element.Wind || aElement == ElementAbilityManager.Element.Wind)
        {
            rocketPackSpell.Enable();
        }
        if (aElement == ElementAbilityManager.Element.Thunder && bElement == ElementAbilityManager.Element.Wind ||
            aElement == ElementAbilityManager.Element.Wind && bElement == ElementAbilityManager.Element.Thunder)
        {
            lavaSpell.Enable();
        }
        if (aElement == ElementAbilityManager.Element.Ice && bElement == ElementAbilityManager.Element.Wind ||
            aElement == ElementAbilityManager.Element.Wind && bElement == ElementAbilityManager.Element.Ice)
        {
            meteorShowerSpell.Enable();
        }
        if (aElement == ElementAbilityManager.Element.Ice && bElement == ElementAbilityManager.Element.Thunder ||
            aElement == ElementAbilityManager.Element.Thunder && bElement == ElementAbilityManager.Element.Ice)
        {
            selfExplosionSpell.Enable();
        }
    }
Beispiel #10
0
    //激活该主元素,同时制定两个辅助元素
    public void Activate(ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
    {
        isOn = true;
        //把雷主元素本身需要的资源激活
        thunderCircleRenderer.enabled = true;

        //把制定辅助技能所需要的资源激活
        //雷球
        thunderBallSpell.Enable();

        thunderLongSpell.Enable();

        //激活闪电链
        if (aElement == ElementAbilityManager.Element.Fire || bElement == ElementAbilityManager.Element.Fire)
        {
            thunderLinkSpell.Enable();
        }
        else if (aElement == ElementAbilityManager.Element.Ice || bElement == ElementAbilityManager.Element.Ice)
        {
            thunderIceSpell.Enable();
        }
    }
Beispiel #11
0
    public bool Casting(bool isFullySpelt, ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
    {
        if (movementComponent.RequestChangeControlStatus(0f, MovementPlayer.PlayerControlStatus.Casting))
        {
            if (isFullySpelt && aElement == ElementAbilityManager.Element.NULL && bElement == ElementAbilityManager.Element.NULL)
            {
                //显示选择界面
                weaponChangePanel.SetActive(true);

                if (platform == PlatformJudge.Platfrom.PC || platform == PlatformJudge.Platfrom.WEB_PC)
                {
                    if (Input.GetKeyUp(KeyCode.A))
                    {
                        //切换到
                        weaponChangeUI.ChooseWeapon(IceWeapon.Shield);
                        weapon = IceWeapon.Shield;
                    }
                    else if (Input.GetKeyUp(KeyCode.D))
                    {
                        weaponChangeUI.ChooseWeapon(IceWeapon.Sword);
                        weapon = IceWeapon.Sword;
                    }
                    else if (Input.GetKeyUp(KeyCode.W))
                    {
                        weaponChangeUI.ChooseWeapon(IceWeapon.Arrow);
                        weapon = IceWeapon.Arrow;
                    }
                    else if (Input.GetKeyUp(KeyCode.S))
                    {
                        weaponChangeUI.ChooseWeapon(IceWeapon.Hammer);
                        weapon = IceWeapon.Hammer;
                    }
                }
                else
                {
                    float x = joystick.Horizontal;
                    float y = joystick.Vertical;
                    //左
                    if (x < -0.5f)
                    {
                        //切换到
                        weaponChangeUI.ChooseWeapon(IceWeapon.Shield);
                        weapon = IceWeapon.Shield;
                    }
                    //右
                    else if (x > 0.5f)
                    {
                        weaponChangeUI.ChooseWeapon(IceWeapon.Sword);
                        weapon = IceWeapon.Sword;
                    }
                    //上
                    else if (y > 0.5f)
                    {
                        weaponChangeUI.ChooseWeapon(IceWeapon.Arrow);
                        weapon = IceWeapon.Arrow;
                    }
                    //下
                    else if (y < -0.5f)
                    {
                        weaponChangeUI.ChooseWeapon(IceWeapon.Hammer);
                        weapon = IceWeapon.Hammer;
                    }
                }
            }
            else
            {
                //选择界面消失
                weaponChangePanel.SetActive(false);
            }
            return(true);
        }
        return(false);
    }
    /// <summary>
    /// 判断攻击类型,并触发机关
    /// </summary>
    /// <param name="who"></param>
    /// <param name="damage"></param>
    /// <param name="interruptType"></param>
    /// <param name="element"></param>
    /// <returns></returns>
    public override int BeAttacked(GameObject who, int damage, AttackInterruptType interruptType, ElementAbilityManager.Element element = ElementAbilityManager.Element.NULL)
    {
        if (element == ElementAbilityManager.Element.Fire)
        {
            mechanism.Trigger(Mechanism.TiggerType.Fire);
        }
        else if (element == ElementAbilityManager.Element.Ice)
        {
            mechanism.Trigger(Mechanism.TiggerType.Ice);
        }
        else if (element == ElementAbilityManager.Element.Wind)
        {
            mechanism.Trigger(Mechanism.TiggerType.Wind);
        }
        else if (element == ElementAbilityManager.Element.Thunder)
        {
            mechanism.Trigger(Mechanism.TiggerType.Thunder);
        }

        return(0);
    }
Beispiel #13
0
    //private CanBeFightedManager magener;

    /// <summary>
    /// 被攻击时调用,将攻击信息记录到受击信息数组中去
    /// </summary>
    /// <param name="who">伤害来源</param>
    /// <param name="damage">造成的伤害,并不判定是否合法</param>
    /// <returns>返回具体造成的伤害</returns>
    public virtual int BeAttacked(GameObject who, int damage, AttackInterruptType interruptType, ElementAbilityManager.Element element = ElementAbilityManager.Element.NULL)
    {
        if (!isImmune)
        {
            if (attackListPointer >= ATTACK_LIST_MAX_SIZE)
            {
                Debug.LogError("在" + gameObject.name + "物体中,在一帧中beAttacked数量超过上限" + ATTACK_LIST_MAX_SIZE);
                attackListPointer = 0;
            }
            isAttacked = true;
            beAttackedList[attackListPointer] = new AttackContent(who, damage, interruptType);
            attackListPointer++;
            Debug.Log(gameObject.name + "收到了来自" + who.name + "的攻击,栈顶指针为" + attackListPointer);

            return(damage);
        }
        return(0);
    }
Beispiel #14
0
 public bool Casting(bool isFullySpelt, ElementAbilityManager.Element aElement, ElementAbilityManager.Element bElement)
 {
     return(movementComponent.RequestChangeControlStatus(0f, MovementPlayer.PlayerControlStatus.Casting));
 }
Beispiel #15
0
    /// <summary>
    /// 范围性攻击,实现方法为输入表示范围的Collier2D,检测范围内的每个拥有CanBeFighted的敌人,调用BeAttacked
    /// </summary>
    /// <param name="area">表示攻击范围的collier2d, 应该为trigger态</param>
    /// <param name="damage">该次范围攻击造成了多少伤害</param>
    /// <param name="interruptType">该次攻击为何种打断类型</param>
    /// <returns>返回攻击到的敌人对象的CanBeFighted组件的数组</returns>
    public CanBeFighted[] AttackArea(Collider2D area, int damage, AttackInterruptType interruptType = AttackInterruptType.NONE, ElementAbilityManager.Element element = ElementAbilityManager.Element.NULL)
    {
        //输入范围需要Trigger才行
        if (!area.isTrigger)
        {
            Debug.LogError("在" + gameObject.name + "释放范围攻击时,输入的collider2d并不是trigger态");
            return(null);
        }

        Collider2D[] enemies       = new Collider2D[ENMEIES_MAX_NUM_ONEATTACK];
        int          enemiesNumber = area.OverlapCollider(filter, enemies);

        if (enemiesNumber != 0)
        {
            Debug.Log("攻击碰到敌人");

            CanBeFighted[] enemiesAttacked = new CanBeFighted[enemiesNumber];
            CanBeFighted   enemyBody;
            //对碰到的敌人进行以下操作,如果敌人有CanBeFighted组件,则施加攻击,否则报错

            for (int i = 0; i < enemiesNumber; i++)
            {
                if (enemies[i].TryGetComponent <CanBeFighted>(out enemyBody))
                {
                    Attack(enemyBody, damage, AttackInterruptType.NONE, element);
                    enemiesAttacked[i] = enemyBody;
                }
                else
                {
                    Debug.LogError("在" + gameObject.name +
                                   "释放范围攻击时,这些物体被检测为敌人,但是没有CanBeFighted组件" + enemies[i].gameObject.name);
                }
            }
            return(enemiesAttacked);
        }

        return(null);
    }
Beispiel #16
0
 /// <summary>
 /// 对一个能够战斗的目标造成伤害,作为底层私有函数被调用
 /// </summary>
 /// <param name="target">造成伤害的目标</param>
 /// <param name="damage">造成输入数值的伤害</param>
 /// <param name="interruptType">攻击打断类型,默认为无打断</param>
 /// <returns>返回造成了多少伤害,具体用法有待进一步讨论</returns>
 public int Attack(CanBeFighted target, int damage, AttackInterruptType interruptType = AttackInterruptType.NONE, ElementAbilityManager.Element element = ElementAbilityManager.Element.NULL)
 {
     if (!isInitialized)
     {
         Debug.LogError("在" + gameObject.name + "物体中,CanFight组件未初始化!");
     }
     return(target.BeAttacked(gameObject, damage, interruptType, element));
 }