Exemplo n.º 1
0
    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        return(0);

        if (Agent.BlackBoard.HasAttackTarget == false)
        {
            return(0);
        }
        if (Agent.BlackBoard.DesiredTargetInWeaponRange)
        {
            return(0);
        }
        if (Agent.BlackBoard.motionType != MotionType.NONE &&
            Agent.BlackBoard.motionType != MotionType.ANIMATION_DRIVE)
        {
            return(0);
        }

        if (ws.Get((int)WorldStatePropType.WILL_PLAY_ANIM))
        {
            return(Agent.BlackBoard.GOAPMaxWeightShow);
        }
        else if (Random.Range(0, 100) < 1)
        {
            ws.Set((int)WorldStatePropType.WILL_PLAY_ANIM, true);
        }

        return(0);
    }
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     if (_eventGoTo != null)
     {
         _eventGoTo.Release();
         _eventGoTo = null;
     }
     base.OnExit(ws);
 }
Exemplo n.º 3
0
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     if (_eventPlayAnim != null)
     {
         _eventPlayAnim.Release();
         _eventPlayAnim = null;
     }
     base.OnExit(ws);
 }
Exemplo n.º 4
0
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     if (_eventCombatMove != null)
     {
         _eventCombatMove.Release();
         _eventCombatMove = null;
     }
     base.OnExit(ws);
 }
Exemplo n.º 5
0
    //public override bool IsAborted()
    //{
    //    return false;
    //}

    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        if (ws.Get((int)WorldStatePropType.REACT_TO_DAMAGE))
        {
            return(1f);
        }

        return(0);
    }
Exemplo n.º 6
0
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     if (_eventAttackWhirl != null)
     {
         _eventAttackWhirl.Release();
         _eventAttackWhirl = null;
     }
     base.OnExit(ws);
 }
Exemplo n.º 7
0
    //public override bool IsAborted()
    //{
    //    return false;
    //}

    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        if (ws.Get((int)WorldStatePropType.IN_IDLE) &&
            Agent.BlackBoard.WeaponInHand &&
            (Agent.BlackBoard.HasAttackTarget == false))
        {
            return(Agent.BlackBoard.GOAPMaxWeightCalm);
        }
        return(0);
    }
Exemplo n.º 8
0
    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        if (Agent.BlackBoard.HasAttackTarget == false)
        {
            return(0);
        }

        if (Agent.BlackBoard.LookAtDesiredTarget && Agent.Decision.GetNearestAgent(Direction.Left,
                                                                                   0.4f, Game1.Instance.AgentMgr.agents) != null)
        {
            return(Agent.BlackBoard.GOAPMaxWeightAvoidRight);
        }

        return(0);
    }
Exemplo n.º 9
0
    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        if (IsRunning && Agent.BlackBoard.InRollMotion)
        {
            return(Agent.BlackBoard.GOAPMaxWeightRetreat);
        }
        if (Agent.BlackBoard.HasAttackTarget == false)
        {
            return(0);
        }

        //if (Agent.BlackBoard.Fear < Agent.BlackBoard.maxFear * 0.25f)
        //    return 0;

        // 后面有人
        if (Agent.Decision.GetNearestAgent(Direction.Backward, 0.4f, Game1.Instance.AgentMgr.agents) != null)
        {
            return(0);
        }

        if (ws.Get((int)WorldStatePropType.IN_COMBAT_RANGE) == false)
        {
            return(0);
        }

        if (Agent.BlackBoard.InAttackCD)
        {
            return(Mathf.Min(Agent.BlackBoard.GOAPMaxWeightRetreat * Agent.BlackBoard.desiredTarget.BlackBoard.weaponRange
                             / Agent.BlackBoard.DistanceToDesiredTarget, Agent.BlackBoard.GOAPMaxWeightRetreat));
        }

        float ret = Agent.BlackBoard.GOAPMaxWeightRetreat * (Agent.BlackBoard.Fear * 0.01f);

        if (Agent.BlackBoard.DistanceToDesiredTarget <= Agent.BlackBoard.desiredTarget.BlackBoard.weaponRange)
        {
            ret += 0.2f;
        }
        if (Agent.BlackBoard.AheadOfDesiredTarget == false)
        {
            ret *= 0.5f;
        }
        if (ret > Agent.BlackBoard.GOAPMaxWeightRetreat)
        {
            ret = Agent.BlackBoard.GOAPMaxWeightRetreat;
        }
        return(ret);
    }
Exemplo n.º 10
0
    //public override bool IsAborted()
    //{
    //    return false;
    //}

    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        if (ws.Get((int)WorldStatePropType.ORDER_ATTACK))
        {
            return(Agent.BlackBoard.GOAPMaxWeightOrderAttack);
        }
        else
        {
            OrderDataAttack order = Agent.PlayerOrder.GetCurOrder() as OrderDataAttack;
            if (order != null)
            {
                ws.Set((int)WorldStatePropType.ORDER_ATTACK, true);
                return(Agent.BlackBoard.GOAPMaxWeightOrderAttack);
            }
        }

        return(0);
    }
Exemplo n.º 11
0
    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        if (Agent.BlackBoard.HasAttackTarget == false)
        {
            return(0);
        }

        if (ws.Get((int)WorldStatePropType.LOOKING_AT_TARGET))
        {
            return(0);
        }

        if (ws.Get((int)WorldStatePropType.IN_WEAPON_RANGE))
        {
            return(0);
        }

        return(Mathf.Min(Agent.BlackBoard.GOAPMaxWeightAlert, Agent.BlackBoard.ForwardAngleToDesiredTarget * 0.01f));
    }
Exemplo n.º 12
0
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     if (_eventInjury != null)
     {
         _eventInjury.Release();
         _eventInjury = null;
     }
     if (_eventKnockDown != null)
     {
         _eventKnockDown.Release();
         _eventKnockDown = null;
     }
     if (_eventDeath != null)
     {
         _eventDeath.Release();
         _eventDeath = null;
     }
     base.OnExit(ws);
 }
Exemplo n.º 13
0
    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        if (IsRunning && (Agent.BlackBoard.InAttackMotion || Agent.BlackBoard.InRollMotion))
        {
            return(Agent.BlackBoard.GOAPMaxWeightAttackTarget);
        }

        if (Agent.BlackBoard.HasAttackTarget == false)
        {
            return(0);
        }

        if (Agent.BlackBoard.InAttackCD)
        {
            return(0);
        }

        // 前面有其它人挡着
        Agent1 someone = Agent.Decision.GetNearestAgent(Direction.Forward, 0.4f, Game1.Instance.AgentMgr.agents);

        if (someone != null && someone != Agent.BlackBoard.desiredTarget)
        {
            return(0);
        }

        float attackValue = 0;

        if (Agent.BlackBoard.maxRage > 0)
        {
            attackValue = Agent.BlackBoard.Rage / Agent.BlackBoard.maxRage;
        }
        if (Agent.BlackBoard.maxBerserk > 0)
        {
            attackValue = Mathf.Max(attackValue, Agent.BlackBoard.Berserk / Agent.BlackBoard.maxBerserk);
        }
        if (attackValue < 0.25f)
        {
            return(0);
        }

        return(Mathf.Min(Agent.BlackBoard.GOAPMaxWeightAttackTarget,
                         Agent.BlackBoard.GOAPMaxWeightAttackTarget * attackValue));
    }
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     Agent.BlackBoard.invulnerable = false;
     if (_eventInjury != null)
     {
         _eventInjury.Release();
         _eventInjury = null;
     }
     if (_eventDeath != null)
     {
         _eventDeath.Release();
         _eventDeath = null;
     }
     if (_eventAttack != null)
     {
         _eventAttack.Release();
         _eventAttack = null;
     }
     base.OnExit(ws);
 }
Exemplo n.º 15
0
    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        if (Agent.BlackBoard.HasAttackTarget == false)
        {
            return(0);
        }

        // 前面有人
        if (Agent.Decision.GetNearestAgent(Direction.Forward, 0.4f, Game1.Instance.AgentMgr.agents) != null)
        {
            return(0);
        }

        if (ws.Get((int)WorldStatePropType.IN_COMBAT_RANGE))
        {
            return(0);
        }

        return(Mathf.Min(Agent.BlackBoard.GOAPMaxWeightPress,
                         (Agent.BlackBoard.DistanceToDesiredTarget - Agent.BlackBoard.combatRange) * 0.3f));
    }
Exemplo n.º 16
0
    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        if (Agent.BlackBoard.HasAttackTarget == false)
        {
            return(0);
        }
        if (Agent.BlackBoard.DesiredTargetInCombatRange == false)
        {
            return(0);
        }
        if (Agent.BlackBoard.LookAtDesiredTarget == false)
        {
            return(0);
        }
        if (Agent.BlackBoard.AheadOfDesiredTarget == false)
        {
            return(0);
        }

        return(Mathf.Min(Agent.BlackBoard.GOAPMaxWeightBlock,
                         Agent.BlackBoard.GOAPMaxWeightBlock * Agent.BlackBoard.Block * 0.01f));
    }
Exemplo n.º 17
0
 public override void OnEnter(Phenix.Unity.AI.WorldState ws)
 {
     UnityEngine.Debug.Log("attack");
     base.OnEnter(ws);
 }
Exemplo n.º 18
0
 public override void OnEnter(Phenix.Unity.AI.WorldState ws)
 {
     base.OnEnter(ws);
     UnityEngine.Debug.Log("retreat");
 }
Exemplo n.º 19
0
 public override void OnEnter(Phenix.Unity.AI.WorldState ws)
 {
     base.OnEnter(ws);
     //_target = Agent.BlackBoard.desiredTarget;
 }
Exemplo n.º 20
0
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     Agent.BlackBoard.damageResultType = DamageResultType.NONE;
     base.OnExit(ws);
 }
Exemplo n.º 21
0
 public override void OnEnter(Phenix.Unity.AI.WorldState ws)
 {
     base.OnEnter(ws);
     // Debug.Log("alert");
 }
Exemplo n.º 22
0
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     PlayerOrderPool.attacks.Collect(Agent.PlayerOrder.Pop() as OrderDataAttack);
     base.OnExit(ws);
 }
Exemplo n.º 23
0
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     Agent.BlackBoard.nextAttackTimer = Time.timeSinceLevelLoad + Agent.BlackBoard.attackCD;
     base.OnExit(ws);
 }
Exemplo n.º 24
0
    //public override bool IsAborted()
    //{
    //    return false;
    //}

    public override float GetWeight(Phenix.Unity.AI.WorldState ws)
    {
        return(Agent.BlackBoard.GOAPMaxWeightIdle);
    }