void Update() { float distToRedBank = Vector3.Distance(transform.position, GameManager_LP.Instance.RedBankMarker.position); float distToYellowBank = Vector3.Distance(transform.position, GameManager_LP.Instance.YellowBankMarker.position); distToPlayer = Vector3.Distance(transform.position, Player_LP.Instance.transform.position); //Debug.Log("Dist to player is: " + distToPlayer); if (Player_LP.Instance.playerStatus == PlayerStatus.DraggingBoat) { if (boatStatus != BankStatus.YellowBank) { if (distToYellowBank < 2.65f) { boatStatus = BankStatus.YellowBank; Debug.Log("BOAT Arrived on Yellow Coast!"); if (cargo) { Debug.Log("UNLOADING BOAT ON THE YELLOW COAST"); cargo.GetComponent <Animal_LP>().animalStatus = boatStatus; UnloadTheBoat(); } DetachBoatFromPlayer(); //StartCoroutine(UIManager_LP.Instance.InstructionsTextIncoming(String.Format("The boat has been released."))); } } if (boatStatus != BankStatus.RedBank) { if (distToRedBank < 4.5f) { boatStatus = BankStatus.RedBank; Debug.Log("BOAT Arrived on Red Coast!"); if (cargo) { Debug.Log("UNLOADING BOAT ON THE RED COAST"); cargo.GetComponent <Animal_LP>().animalStatus = boatStatus; UnloadTheBoat(); } DetachBoatFromPlayer(); } //StartCoroutine(UIManager_LP.Instance.InstructionsTextIncoming(String.Format("The boat has been released."))); } } if (Input.GetKeyDown(KeyCode.Space)) { if (Player_LP.Instance.playerStatus == PlayerStatus.DraggingBoat) { DetachBoatFromPlayer(); } //if we hit the space bar and we're looking at the boat... if (PlayerGaze.Instance.myGazeStatus.Equals(GazeStatus.Boat) && Player_LP.Instance.playerStatus != PlayerStatus.DraggingBoat) { AttachBoatToPlayer(); } } }
private PaymentStatus GetStatus(BankStatus status) { switch (status) { case BankStatus.Success: return(PaymentStatus.Success); default: return(PaymentStatus.Failure); } }
IEnumerator TransferToBoatParabola(Vector3 startPos, Vector3 endPos) { float dist = 0; transform.Find("ParticleHolder").GetComponent <ParticleSystem>().Play(); Debug.Log("Moving into Boat"); dist = Vector3.Distance(transform.position, endPos); while (dist > 0.1f) { parabolaAnimation += Time.deltaTime; parabolaAnimation = parabolaAnimation % 5f; if (spacebarDown) { endPos = Boat_LP.Instance.cargoPosition.position; Debug.Log("we're inside the parabola loop"); dist = Vector3.Distance(transform.position, endPos); transform.position = MathParabola.Parabola(startPos, endPos, 1.2f, parabolaAnimation / 5f); } else { canceledParabola = true; dist = Vector3.Distance(transform.position, startPos); transform.position = MathParabola.Parabola(transform.position, startPos, 1.2f, parabolaAnimation / 5f); Debug.Log("Canceled Parabola"); } yield return(null); } transform.Find("ParticleHolder").GetComponent <ParticleSystem>().Stop(); if (canceledParabola) { Debug.Log("Canceled Parabola so we're returning to start position."); transform.position = startPos; canceledParabola = false; PlayerGaze.Instance.ClearGaze(); yield break; } transform.position = endPos; animalStatus = BankStatus.Boat; transform.SetParent(Boat_LP.Instance.transform.Find("Boat")); transform.GetComponent <Collider>().enabled = false; Boat_LP.Instance.cargo = gameObject; PlayerGaze.Instance.ClearGaze(); Debug.Log("Made it to the part where the boat Cargo is set..."); }
public Vector3 FindMyBankPosition(BankStatus bankStat) { animalStatus = bankStat; switch (transform.name) { case "Wolf": if (bankStat.Equals(BankStatus.YellowBank)) { return(GameManager_LP.Instance.wolfSpotYellowBank); } else { return(GameManager_LP.Instance.wolfSpotRedBank); } case "Chicken": if (bankStat.Equals(BankStatus.YellowBank)) { return(GameManager_LP.Instance.chickenSpotYellowBank); } else { return(GameManager_LP.Instance.chickenSpotRedBank); } case "Cabbage": if (bankStat.Equals(BankStatus.YellowBank)) { return(GameManager_LP.Instance.cabbageSpotYellowBank); } else { return(GameManager_LP.Instance.cabbageSpotRedBank); } default: Debug.Log("No bank position found"); return(transform.position); } }
void Update() { if (pullingBoat) { PullBoat(); } float distToRedBank = Vector3.Distance(transform.position, GameManager_LP.Instance.RedBankMarker.position); float distToYellowBank = Vector3.Distance(transform.position, GameManager_LP.Instance.YellowBankMarker.position); if (distToYellowBank < 8.0f) { playerBank = BankStatus.YellowBank; //Debug.Log("Player on Yellow Coast"); } if (distToRedBank < 8.0f) { playerBank = BankStatus.RedBank; //Debug.Log("Player on Red Coast"); } }
void Start() { boatStatus = BankStatus.None; }
// Use this for initialization public virtual void Start() { myId = gameObject.name; animalStatus = BankStatus.YellowBank; //transform.Find("ParticleHolder").GetComponent<ParticleSystem>().Play(); }