示例#1
0
    /// <summary>
    /// 行動を開始する
    /// </summary>
    /// <param name="n">行動の番号(種類)</param>
    public void StartAction(int n)
    {
        if (battleManager != null && (!battleManager.IsMatchDeside))
        {
            if (!isDuaringAction)
            {
                ActionParamater ap = null;
                switch (n)
                {
                case 0:
                    ap = AttackPram;
                    break;

                case 1:
                    ap = GuardParam;
                    break;

                case 2:
                    ap = DodgeParam;
                    break;

                default:
                    return;
                }

                if (status.UseStamina((float)ap.StaminaConsumption))
                {
                    actionSequencer.Activate(ap);
                }

                isDuaringAction = true;
            }
        }
    }
示例#2
0
    void OnSequencerChangeMode(ActionSequencer.Mode newMode, ActionParamater ap)
    {
        //アクションシーケンサーの状態の変化によって表示を変更する
        //デリゲートとしてアクションシーケンサーに登録して利用する関数

        switch (newMode)
        {
        case ActionSequencer.Mode.PRELIMINARY_BEFORE:
            Activate(ap);
            break;

        case ActionSequencer.Mode.MAIN:
            image.color = valiedColor;
            image.rectTransform.localScale = new Vector3(1, 1, 1) * sizeRate_valid;
            break;

        case ActionSequencer.Mode.PRELIMINARY_END:
            image.color = normalColor;
            image.rectTransform.localScale = new Vector3(1, 1, 1) * sizeRate_valid;
            break;

        case ActionSequencer.Mode.FINISHED:
            Deactivate();
            break;

        default:
            Debug.Log("バグ");
            break;
        }
        lastInputedMode = newMode;
    }
示例#3
0
 //非アクティブにする
 public void Deactivate(bool force = false)
 {
     if (mode != Mode.STAND_BY || force)
     {
         timer.ResetTimer();
         mode = Mode.STAND_BY;
         currentActionParameter = null;
     }
 }
示例#4
0
    void OnActionSequencerChangeMode(int characterNum, ActionSequencer.Mode newMode, ActionParamater ap)
    {
        Character me = characterList[characterNum];

        int       otherCharacterNum = (characterNum == 0) ? 1 : 0;
        Character other             = characterList[otherCharacterNum];

        if (newMode == ActionSequencer.Mode.MAIN)
        {
            switch (ap.Type)
            {
            case ActionParamater.TYPE.ATTACK:
                AttackProcess(me, other);
                break;
            }
        }
    }
示例#5
0
    public void StartAction(ActionParamater ap)
    {
        if (ap != null)
        {
            if (battleManager != null && (!battleManager.IsMatchDeside))
            {
                if (!isDuaringAction)
                {
                    if (status.UseStamina((float)ap.StaminaConsumption))
                    {
                        actionSequencer.Activate(ap);
                    }

                    isDuaringAction = true;
                }
            }
        }
    }
示例#6
0
    //アクティブにする
    public void Activate(ActionParamater ap)
    {
        if (!active)
        {
            //状態初期化
            image.rectTransform.localScale = new Vector3(1, 1, 1) * sizeRate_normal;

            active = true;

            //完全不透過
            Color c = normalColor;
            c.a         = 1;
            image.color = c;

            //アイコン画像を設定
            image.sprite = ap.Sprite;
        }
    }
示例#7
0
    //アクティブにする
    public void Activate(ActionParamater ap)
    {
        if (mode == Mode.STAND_BY)
        {
            //状態初期化
            mode = Mode.PRELIMINARY_BEFORE;

            //稼働時間を設定
            currentActionParameter = ap;
            timer.StartTimer(ap.Time_preliminary_before);

            if (eventOnChangeMode != null)
            {
                foreach (EventOnChangeMode ev in eventOnChangeMode)
                {
                    ev(mode, currentActionParameter);
                }
            }
        }
    }
示例#8
0
    void AttackProcess(Character me, Character other)
    {
        bool AttackHitFlag = true;

        ActionSequencer otherCharacterActSeq = other.ActionSequencer;

        if (otherCharacterActSeq != null)
        {
            if (otherCharacterActSeq.Active)
            {
                if (otherCharacterActSeq.CurrentMode == ActionSequencer.Mode.MAIN)
                {
                    ActionParamater otherActParam = otherCharacterActSeq.CurrentActionParamater;

                    if (otherActParam != null)
                    {
                        switch (otherActParam.Type)
                        {
                        case ActionParamater.TYPE.DODGE:
                            AttackHitFlag = false;
                            break;

                        case ActionParamater.TYPE.GUARD:
                            AttackHitFlag = false;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }

        if (AttackHitFlag)
        {
            other.OnAttacked(me);
        }
    }
示例#9
0
    protected override void Update()
    {
        base.Update();

        if (!IsDuaringAction)
        {
            if (isDuaringActionPrev == true)
            {
                timer.StartTimer(actionInterval);
            }
            else
            {
                if (!(timer.isRunning))
                {
                    int             rand = Random.Range(0, 100);
                    ActionParamater act  = actionSet.GetActionSetElement(rand);
                    StartAction(act);
                }
            }
        }

        isDuaringActionPrev = IsDuaringAction;
    }
示例#10
0
 void OnChangeEventCharacter1(ActionSequencer.Mode newMode, ActionParamater ap)
 {
     OnActionSequencerChangeMode(1, newMode, ap);
 }