Esempio n. 1
0
            if ai.checkFrame():
                # print("Markers encontrados: ", ai.markers)
                if 1 not in stateMachine.values():
                    print("Fiquei entediado")
                    stateMachine["Vagando"] = 1

                if stateMachine["Parado"]:
                    velArr = [Vector3(0, 0, 0), Vector3(0, 0, 0)]
                else:
                    # print("nao estou parado")
                    if stateMachine["Vagando"]:
                        # print("estou vagando")
                        streetPoint = ai.followRoad()
                        if streetPoint is not None:
                            velArr = ai.alignToTarget(streetPoint)
                            stateMachine["AvancandoEstrada"] = 1
                            if stateMachine["AvancandoEstrada"]:
                                velArr = ai.slowAdvance()
                                ai.counters["FramesSemAlinharEstrada"] += 1
                                # print(ai.counters)
                                if ai.counters["FramesSemAlinharEstrada"] >= 5:
                                    ai.counters["FramesSemAlinharEstrada"] = 0
                                    stateMachine["AvancandoEstrada"] = 0
                                    velArr = ai.alignToTarget(streetPoint)
                        # else:
                        # 	velArr = ai.searchRotate()
                        if stateMachine["AlinhandoCor"]:
                            colorPoint = ai.identifyCreeper()
                            if colorPoint is not None:
                                print(colorPoint.getTuple())