/// <summary> /// Handles the withbox state. /// </summary> void HandleWithBox() { // Error handling if (_currentBoxPicked.box == null) { Debug.LogWarning("Current box picked is not found? Probably an error picking it?"); _currentState = RobotState.SEARCH; return; } if (_currentBoxPicked.box == null) { Debug.LogWarning("Current box picked script is not found? Probably an error picking it?"); _currentState = RobotState.SEARCH; return; } // Move to desired door. _desiredDropPoint = _gm.GiveDoor(_colorOfRobot); Vector3 objective = _desiredDropPoint.transform.position; _rm.Move(objective); _op.SetTarget(_currentBoxPicked.box); _op.Stay(); if (_rm.IsHeNearInstance(objective)) { _door = _desiredDropPoint; DropPointLogic dropper = _door.GetComponent <DoorRobotInteraction>().dropper; dropper.AddToQueue(this); Debug.LogWarning("DOOR WARNING " + _door.GetInstanceID()); _currentState = RobotState.QUEUE; } }
void HandleQueue() { DropPointLogic dropper = _door.GetComponent <DoorRobotInteraction>().dropper; _op.SetTarget(_currentBoxPicked.box); _op.Stay(); if (dropper.CanIGo(gameObject.GetInstanceID())) { _currentState = RobotState.GOTOWAITZONE; _rm.SetInstantSpeed(0); } }
void HandleGoToWaitZone() { DropPointLogic dropperForWaitZone = _door.GetComponent <DoorRobotInteraction>().dropper; _rm.Move(dropperForWaitZone.GetPoint(PointsDrop.WAITSTATION)); _op.SetTarget(_currentBoxPicked.box); _op.Stay(); if (_rm.IsHeNearInstance(dropperForWaitZone.GetPoint(PointsDrop.WAITSTATION))) { _currentState = RobotState.INWAITZONE; _rm.SetInstantSpeed(0); } }
/// <summary> /// Handles the gonna drop. /// </summary> /// <returns><c>true</c>, if gonna drop was handled, <c>false</c> otherwise.</returns> bool HandleGonnaDrop() { DropPointLogic dropper = _door.GetComponent <DoorRobotInteraction>().dropper; PointsDrop can_ = dropper.WhatDrop(gameObject.GetInstanceID()); Vector3 pt = dropper.GetPoint(can_ == PointsDrop.DROPRIGHT ? PointsDrop.VENTCORRECT : PointsDrop.VENTINCORRECT); transform.LookAt(pt); droppedInRight = dropper.WhereIsHe(); if (_rm.IsHeLookingAt(pt)) { _currentState = RobotState.LEAVEBOX; return(dropper.WhereIsHe()); } return(dropper.WhereIsHe()); }
void HandleInWaitZone() { DropPointLogic dropper_ = _door.GetComponent <DoorRobotInteraction>().dropper; PointsDrop can = dropper_.WhatDrop(gameObject.GetInstanceID()); _op.SetTarget(_currentBoxPicked.box); _op.Stay(); dropper_.waitZone = this; if (can != PointsDrop.NOTHING) { _rm.Move(dropper_.GetPoint(can)); if (_rm.IsHeNearInstance(dropper_.GetPoint(can))) { dropper_.SetIDLE(); dropper_.SetBotInDropZone(this, can); // Debug.Log("WE ARE GODS"); _currentState = RobotState.GONNADROP; dropper_.waitZone = null; } } }
bool HandleGonnaDrop() { DropPointLogic dropper = _door.GetComponent <DoorRobotInteraction>().dropper; PointsDrop can_ = dropper.WhatDrop(gameObject.GetInstanceID()); Vector3 pt = dropper.GetPoint(can_ == PointsDrop.DROPRIGHT ? PointsDrop.VENTCORRECT : PointsDrop.VENTINCORRECT); transform.LookAt(pt); //if (dropper.WhereIsHe()) //{ // what = true; //if he's going to the correct path, go true //} //else what = false; //if not, go false. droppedInRight = dropper.WhereIsHe(); if (_rm.IsHeLookingAt(pt)) { _currentState = RobotState.LEAVEBOX; // Debug.Log("Yo i'm lookin at the droppah"); return(dropper.WhereIsHe()); } return(dropper.WhereIsHe()); }
/// <summary> /// Handles the exit dropper. /// </summary> /// <param name="isRight">If set to <c>true</c> is right.</param> void HandleExitDropper(bool isRight) { DropPointLogic dropper = _door.GetComponent <DoorRobotInteraction>().dropper; PointsDrop use = PointsDrop.EXITCORRECT; if (isRight) { use = PointsDrop.EXITCORRECT; _rm.Move(dropper.GetPoint(use)); } else { use = PointsDrop.EXITINCORRECT; _rm.Move(dropper.GetPoint(use)); } if (_rm.IsHeNearInstance(dropper.GetPoint(use))) { _door = null; _currentState = RobotState.SEARCH; } }