// Update is called once per frame public override BEHAVIOUR_STATUS Update() { BEHAVIOUR_STATUS returnStatus = BEHAVIOUR_STATUS.FAILURE; for (int i = 0; i < GetChildBehaviours().Count; i++) { Nodes currentBehaviour = GetChildBehaviours()[i]; returnStatus = currentBehaviour.Update(); if (returnStatus == BEHAVIOUR_STATUS.SUCCESS) { } else { break; } } if (returnStatus == BEHAVIOUR_STATUS.SUCCESS || returnStatus == BEHAVIOUR_STATUS.FAILURE) { Reset(); } return(returnStatus); }
public override BEHAVIOUR_STATUS Update() { BEHAVIOUR_STATUS returnStatus = BEHAVIOUR_STATUS.FAILURE; Nodes currentNode = GetChildBehaviours()[currentIndex]; BEHAVIOUR_STATUS behaviourStatus = currentNode.Update(); if (behaviourStatus == BEHAVIOUR_STATUS.FAILURE) { if (currentIndex == GetChildBehaviours().Count - 1) { returnStatus = BEHAVIOUR_STATUS.FAILURE; } else { ++currentIndex; returnStatus = BEHAVIOUR_STATUS.RUNNING; } } else { returnStatus = behaviourStatus; } if (returnStatus == BEHAVIOUR_STATUS.SUCCESS || returnStatus == BEHAVIOUR_STATUS.FAILURE) { Reset(); } return(returnStatus); }
public override BEHAVIOUR_STATUS Update() { BEHAVIOUR_STATUS returnStatus = BEHAVIOUR_STATUS.FAILURE; if (isCompleted == true) { currentNode = GetChildBehaviours()[Random.Range(0, GetChildBehaviours().Count)]; isCompleted = false; } BEHAVIOUR_STATUS behaviourStatus = currentNode.Update(); if (behaviourStatus == BEHAVIOUR_STATUS.FAILURE) { returnStatus = BEHAVIOUR_STATUS.FAILURE; } else { returnStatus = behaviourStatus; } if (returnStatus == BEHAVIOUR_STATUS.SUCCESS || returnStatus == BEHAVIOUR_STATUS.FAILURE) { isCompleted = true; Reset(); } return(returnStatus); }
public override BEHAVIOUR_STATUS Update() { BEHAVIOUR_STATUS returnStatus = BEHAVIOUR_STATUS.FAILURE; Node currentBehaviour = GetChildBehaviours()[m_currentIndex]; if (currentBehaviour != null) { BEHAVIOUR_STATUS behaviourStatus = currentBehaviour.Update(); if (behaviourStatus == BEHAVIOUR_STATUS.SUCCESS) { if (m_currentIndex == GetChildBehaviours().Count - 1) { returnStatus = BEHAVIOUR_STATUS.SUCCESS; } else { m_currentIndex++; returnStatus = BEHAVIOUR_STATUS.RUNNING; } } else { returnStatus = behaviourStatus; } if (returnStatus == BEHAVIOUR_STATUS.SUCCESS || returnStatus == BEHAVIOUR_STATUS.FAILURE) { Reset(); } } return(returnStatus); }
public override BEHAVIOUR_STATUS Update() { BEHAVIOUR_STATUS returnStatus = BEHAVIOUR_STATUS.NONE; BEHAVIOUR_STATUS previous = GetChildNode().Update(); if (previous == BEHAVIOUR_STATUS.FAILURE) { returnStatus = BEHAVIOUR_STATUS.SUCCESS; } else if (previous == BEHAVIOUR_STATUS.SUCCESS) { returnStatus = BEHAVIOUR_STATUS.FAILURE; } return(returnStatus); }
public override BEHAVIOUR_STATUS Update() { if (m_behaviourPrevious == BEHAVIOUR_STATUS.RUNNING) { m_behaviourPrevious = GetChildNode().Update(); return(m_behaviourPrevious); } m_waitTimer = m_waitTimer - Time.deltaTime; if (m_waitTimer < 0.0f) { m_waitTimer = m_waitTime; m_behaviourPrevious = GetChildNode().Update(); return(m_behaviourPrevious); } else { return(BEHAVIOUR_STATUS.RUNNING); } }
public override BEHAVIOUR_STATUS Update() { Nodes currentNode = GetChildBehaviour(); BEHAVIOUR_STATUS currentBehaviour = currentNode.Update(); if(currentBehaviour == BEHAVIOUR_STATUS.SUCCESS) { return BEHAVIOUR_STATUS.FAILURE; } else if(currentBehaviour == BEHAVIOUR_STATUS.FAILURE) { return BEHAVIOUR_STATUS.SUCCESS; } else { return currentBehaviour; } }
public Nodes() { behaviourStatus = BEHAVIOUR_STATUS.NONE; }