public override void Init(AIStatemachineManager m) { base.Init(m); AITransition goto_stand = new AITransition(); goto_stand.condition = AIConditions.CanSeePlayer; goto_stand.inverse = false; goto_stand.currentState = 0; goto_stand.jumpIndex = 2; AITransition stand_goto = new AITransition(); stand_goto.condition = AIConditions.InDanger; stand_goto.inverse = false; stand_goto.currentState = 0; stand_goto.jumpIndex = 2; AITransition lostLeader = new AITransition(); lostLeader.condition = AIConditions.HasLeader; lostLeader.inverse = true; lostLeader.currentState = 0; lostLeader.jumpIndex = 2; transitions = new AITransition[3]; transitions[0] = goto_stand; transitions[1] = stand_goto; transitions[2] = lostLeader; }
public override void Init(AIStatemachineManager m) { base.Init(m); AITransition attackOnSee = new AITransition(); attackOnSee.condition = AIConditions.CanSeePlayer; attackOnSee.inverse = false; attackOnSee.currentState = 0; attackOnSee.jumpIndex = 1; AITransition stand_cover = new AITransition(); stand_cover.condition = AIConditions.Healthy; stand_cover.inverse = true; stand_cover.currentState = 1; stand_cover.jumpIndex = 2; AITransition stand_approach = new AITransition(); stand_approach.condition = AIConditions.LostPlayer; stand_approach.inverse = false; stand_approach.currentState = 1; stand_approach.jumpIndex = 3; transitions = new AITransition[3]; transitions[0] = attackOnSee; transitions[1] = stand_cover; transitions[2] = stand_approach; }
public override void Init(AIStatemachineManager m) { base.Init(m); transitions = new AITransition[4]; //attack1 transitions[0] = new AITransition(); transitions[0].condition = AIConditions.CanSeePlayer; transitions[0].inverse = false; transitions[0].currentState = 1; transitions[0].jumpIndex = 4; transitions[1] = new AITransition(); transitions[1].condition = AIConditions.CanSeePlayer; transitions[1].inverse = false; transitions[1].currentState = 2; transitions[1].jumpIndex = 4; transitions[2] = new AITransition(); transitions[2].condition = AIConditions.CanSeePlayer; transitions[2].inverse = false; transitions[2].currentState = 3; transitions[2].jumpIndex = 4; transitions[3] = new AITransition(); transitions[3].condition = AIConditions.LostPlayer; transitions[3].inverse = false; transitions[3].currentState = 4; transitions[3].jumpIndex = -1; }
public override void Init(AIStatemachineManager m) { base.Init(m); transitions = new AITransition[4]; transitions[0] = new AITransition(); transitions[0].condition = AIConditions.GoodShoot; transitions[0].inverse = false; transitions[0].currentState = 0; transitions[0].jumpIndex = 2; transitions[1] = new AITransition(); transitions[1].condition = AIConditions.IsRedundant; transitions[1].inverse = false; transitions[1].currentState = 0; transitions[1].jumpIndex = 1; transitions[2] = new AITransition(); transitions[2].condition = AIConditions.IsRedundant; transitions[2].inverse = false; transitions[2].currentState = 2; transitions[2].jumpIndex = 0; transitions[3] = new AITransition(); transitions[3].condition = AIConditions.LostPlayer; transitions[3].inverse = false; transitions[3].currentState = 2; transitions[3].jumpIndex = 0; }
public override void Init(AIStatemachineManager m) { base.Init(m); AITransition goto_stand = new AITransition(); goto_stand.condition = AIConditions.GoodShoot; goto_stand.inverse = false; goto_stand.currentState = 0; goto_stand.jumpIndex = 3; AITransition stand_goto = new AITransition(); stand_goto.condition = AIConditions.LostPlayer; stand_goto.inverse = false; stand_goto.currentState = 3; stand_goto.jumpIndex = 0; AITransition cover_goto = new AITransition(); cover_goto.condition = AIConditions.LostPlayer; cover_goto.inverse = false; cover_goto.currentState = 1; cover_goto.jumpIndex = 0; AITransition goto_cover = new AITransition(); goto_cover.condition = AIConditions.IsRedundant; goto_cover.inverse = false; goto_cover.currentState = 0; goto_cover.jumpIndex = 2; AITransition stand_cover = new AITransition(); stand_cover.condition = AIConditions.IsRedundant; stand_cover.inverse = false; stand_cover.currentState = 3; stand_cover.jumpIndex = 0; transitions = new AITransition[4]; transitions[0] = goto_stand; transitions[1] = stand_goto; //transitions[2] = cover_goto; transitions[2] = goto_cover; transitions[3] = stand_cover; }
public void EvaluateTransitions() { for (int i = 0; i < transitions.Length; ++i) { AITransition transition = transitions[i]; if (transition.currentState != currentState) { continue; } bool evaluation = AIStates.CheckBoleanCondition(transition, blackboardReference, manager.components); if (evaluation) { TransitionState(transition.jumpIndex); break; } } }
public override void Init(AIStatemachineManager m) { base.Init(m); AITransition goto_stand = new AITransition(); goto_stand.condition = AIConditions.CanSeePlayer; goto_stand.inverse = false; goto_stand.currentState = 0; goto_stand.jumpIndex = 1; AITransition stand_goto = new AITransition(); stand_goto.condition = AIConditions.LostPlayer; stand_goto.inverse = false; stand_goto.currentState = 1; stand_goto.jumpIndex = 0; transitions = new AITransition[2]; transitions[0] = goto_stand; transitions[1] = stand_goto; }
public override void Init(AIStatemachineManager m) { Debug.Log("PATROL"); base.Init(m); transitions = new AITransition[5]; transitions[0] = new AITransition(); transitions[0].condition = AIConditions.CanSeePlayer; transitions[0].inverse = false; transitions[0].currentState = 0; transitions[0].jumpIndex = 5; transitions[1] = new AITransition(); transitions[1].condition = AIConditions.CanSeePlayer; transitions[1].inverse = false; transitions[1].currentState = 1; transitions[1].jumpIndex = 5; transitions[2] = new AITransition(); transitions[2].condition = AIConditions.CanSeePlayer; transitions[2].inverse = false; transitions[2].currentState = 2; transitions[2].jumpIndex = 5; transitions[3] = new AITransition(); transitions[3].condition = AIConditions.CanSeePlayer; transitions[3].inverse = false; transitions[3].currentState = 3; transitions[3].jumpIndex = 5; transitions[4] = new AITransition(); transitions[4].condition = AIConditions.LostPlayer; transitions[4].inverse = false; transitions[4].currentState = 4; transitions[4].jumpIndex = 1; }
public static bool CheckBoleanCondition(AITransition transitionData, AIBlackboard blackboard, ComponentBlackboard components) { if (components.locomotion.interrupt) { return(false); } if (transitionData.condition == AIConditions.CanSeePlayer) { bool canSee = blackboard.LineOfSight; if (!transitionData.inverse) { return(canSee); } else { return(!canSee); } } else if (transitionData.condition == AIConditions.IsCloseToPlayer) { if (!transitionData.inverse) { return(blackboard.distanceToPlayer < 13.5f); } else { return(blackboard.distanceToPlayer > 13.5f); } } else if (transitionData.condition == AIConditions.InRange) { if (!transitionData.inverse) { return(blackboard.distanceToPlayer < blackboard.closeAttackRange); } else { return(blackboard.distanceToPlayer > blackboard.closeAttackRange); } } else if (transitionData.condition == AIConditions.GoodShoot) { if (!transitionData.inverse) { return(blackboard.GoodToShoot); } else { return(!blackboard.GoodToShoot); } } else if (transitionData.condition == AIConditions.IsRedundant) { if (!transitionData.inverse) { return(blackboard.redundant); } else { return(!blackboard.redundant); } } else if (transitionData.condition == AIConditions.HasPowerSpot) { if (!transitionData.inverse) { return(blackboard.BestAntiCover != null); } else { return(blackboard.BestAntiCover == null); } } else if (transitionData.condition == AIConditions.HasCover) { if (!transitionData.inverse) { return(blackboard.BestCover != null); } else { return(blackboard.BestCover == null); } } else if (transitionData.condition == AIConditions.LostPlayer) { if (!transitionData.inverse) { return(blackboard.LostPlayer); } else { return(!blackboard.LostPlayer); } } else if (transitionData.condition == AIConditions.InDanger) { bool d = blackboard.CanSeePlayer && !blackboard.GoodToShoot; if (!transitionData.inverse) { return(d); } else { return(!d); } } else if (transitionData.condition == AIConditions.PlayerSpotted) { bool s = AIBlackboard.PlayerSpotted; if (!transitionData.inverse) { return(s); } else { return(!s); } } else if (transitionData.condition == AIConditions.Healthy) { if (components.aiHealth == null) { return(false); } bool healthy = components.aiHealth.currentHealth > components.aiHealth.maxHealth / 2; if (!transitionData.inverse) { return(healthy); } else { return(!healthy); } } else if (transitionData.condition == AIConditions.HasLeader) { bool s = blackboard.squadLeader != null; if (!transitionData.inverse) { return(s); } else { return(!s); } } return(false); }
public override void Init(AIStatemachineManager m) { base.Init(m); transitions = new AITransition[9]; //Flank to shoot transitions[0] = new AITransition(); transitions[0].condition = AIConditions.CanSeePlayer; transitions[0].inverse = false; transitions[0].currentState = 1; transitions[0].jumpIndex = 3; transitions[1] = new AITransition(); transitions[1].condition = AIConditions.CanSeePlayer; transitions[1].inverse = false; transitions[1].currentState = 2; transitions[1].jumpIndex = 3; transitions[2] = new AITransition(); transitions[2].condition = AIConditions.GoodShoot; transitions[2].inverse = false; transitions[2].currentState = 3; transitions[2].jumpIndex = 4; //Attack transitions[3] = new AITransition(); transitions[3].condition = AIConditions.IsRedundant; transitions[3].inverse = false; transitions[3].currentState = 4; transitions[3].jumpIndex = 5; transitions[8] = new AITransition(); transitions[8].condition = AIConditions.CanSeePlayer; transitions[8].inverse = true; transitions[8].currentState = 4; transitions[8].jumpIndex = 5; transitions[4] = new AITransition(); transitions[4].condition = AIConditions.LostPlayer; transitions[4].inverse = true; transitions[4].currentState = 5; transitions[4].jumpIndex = 0; transitions[5] = new AITransition(); transitions[5].condition = AIConditions.LostPlayer; transitions[5].inverse = false; transitions[5].currentState = 6; transitions[5].jumpIndex = 0; //Interrupt flank on close transitions[6] = new AITransition(); transitions[6].condition = AIConditions.IsCloseToPlayer; transitions[6].inverse = false; transitions[6].currentState = 1; transitions[6].jumpIndex = 3; transitions[7] = new AITransition(); transitions[7].condition = AIConditions.IsCloseToPlayer; transitions[7].inverse = false; transitions[7].currentState = 2; transitions[7].jumpIndex = 3; }