Exemplo n.º 1
0
    void OnGUI()
    {
        attacker = GameSystem.game.character;
        attack   = (Action_Attack)attacker.GetActionSystem().action;
        if (attack == null)
        {
            print("Attack is null");
            return;
        }
        if (skin != null)
        {
            GUI.skin = skin;
        }
        GUI.depth = -1;

        GUI.Box(rect_position, "");
        GUI.Label(new Rect(name_x, name_y, rect_position.width, rect_position.y), attacker.name);
        GUI.Label(new Rect(life_x, life_y, rect_position.width, rect_position.y), "Health : " + attacker.Health() + "/" + attacker.HealthMax());
        GUI.Label(new Rect(stamina_x, stamina_y, rect_position.width, rect_position.y), "Stamina : " + attacker.Stamina() + "/" + attacker.StaminaMax());
        GUI.Label(new Rect(touch_x, touch_y, rect_position.width, rect_position.y), "Probabilities of success = " + attack.GetTouchProbality() + "%");
        GUI.Label(new Rect(damage_x, damage_y, rect_position.width, rect_position.y), "Damage estimation = " + attack.GetDamageEstimation());

        if (GUI.Button(new Rect(confirm_x, confirm_y, confirm_w, confirm_h), "Attack!"))
        {
            attack.Attack_Start();
        }
        if (GUI.Button(new Rect(cancel_x, cancel_y, cancel_w, cancel_h), "Cancel"))
        {
            attack.Action_Cancel();
        }
    }
Exemplo n.º 2
0
    void Start()
    {
        root = new BehaviorTree();

        sequence_1 = new Sequence();
        sequence_2 = new Sequence();
        selecter_1 = new Selecter();

        condition_Dead        = new Condition_Dead();
        condition_Fine        = new Condition_Find();
        condition_AttackRange = new Condition_AttackRange();
        condition_Arrive      = new Condition_Arrive();

        timeOut_RoamingDelay = new TimeDelay();

        roaming = new Action_Roaming();
        trace   = new Action_Trace();
        attack  = new Action_Attack();
        dead    = new Action_Dead();

        colliders = new Collider[5];

        //========== 공격 ===================
        condition_AttackRange.SetTask(attack);
        selecter_1.AddTask(condition_AttackRange);
        //===================================

        //========== 추적 ===================
        condition_Fine.SetTask(trace);
        selecter_1.AddTask(condition_Fine);
        //===================================

        //========== 로밍 ===================
        timeOut_RoamingDelay.SetTime(3.0f);
        sequence_2.AddTask(timeOut_RoamingDelay);
        sequence_2.AddTask(roaming);
        condition_Arrive.SetTask(sequence_2);
        selecter_1.AddTask(condition_Arrive);
        //==================================

        sequence_1.AddTask(selecter_1);
        condition_Dead.SetTask(dead);
        sequence_1.AddTask(condition_Dead);

        root.Init(sequence_1);

        enemyCharacter     = GetComponentInChildren <Animator>().gameObject;
        animatorController = GetComponentInChildren <Animator>();
        StartCoroutine(Update_Coroution());
    }
Exemplo n.º 3
0
    /// <summary>
    /// 可能な行動を全て取得する処理
    /// </summary>
    /// <returns></returns>
    private List <Action> GetAllAction()
    {
        List <Action> actions = new List <Action>();

        //手札使用行動を取得
        foreach (CardPoint cp in PlayerStates[0].hand)
        {
            if (player.isCardPlay(cp.card))
            {
                Action_CardPlay action = new Action_CardPlay(player, cp.card);
                action.point = cp.point;
                actions.Add(action);
            }
        }

        //攻撃行動を取得
        if (player.isCanAttack() && GetAttackPoint() > 0)
        {
            Action_Attack attack = new Action_Attack(player, GetAttackTarget());
            attack.point = GetAttackPoint();
            actions.Add(attack);
        }


        //攻撃後に行うべき行動の順序を遅らせる
        List <Action> rate = new List <Action>();

        foreach (Action action in actions)
        {
            if (action.GetType() == typeof(Action_CardPlay) && (action as Action_CardPlay).card.State.atk < 0)
            {
                rate.Add(action);
            }
        }
        //最後尾に送る
        foreach (Action action in rate)
        {
            actions.Remove(action);
            actions.Add(action);
        }

        return(actions);
    }
Exemplo n.º 4
0
 public void SetAttack(Action_Attack _attack)
 {
     attack = _attack;
 }