public void UpdateState() { //TODO: cancel actions in progress //The box is far, Barion is approaching if (moving_to_box == true) { if (Vector3.Distance(barion.transform.position, box.transform.position) <= barion.agent.stoppingDistance) { barion.StopMovement(); PickUpBox(); } else { barion.agent.SetDestination(box.transform.position); //Constantly follow the box } } //Is carrying the box, now move with it. if (carrying_box == true) { //Get new destination if (barion.is_selected) { if (barion.GetMovement(ref destination)) { barion.agent.SetDestination(destination); } } //Update box position Vector3 pos = barion.transform.position; box.transform.position = new Vector3(pos.x, box_height, pos.z); if (drop_box == true) { DropBox(); } } }
public void UpdateState() { //TODO: cancel actions in progress //The corpse is far, Barion is approaching if (moving_to_corpse == true) { if (Vector3.Distance(barion.transform.position, corpse.transform.position) <= barion.agent.stoppingDistance) { barion.StopMovement(); PickUpCorpse(); } else { barion.agent.SetDestination(corpse.transform.position); //Constantly follow the corpse //TODO: Double check why I do this. The box isn't going anywhere, why set the destination every update? } } //Is carrying the corpse, now move with it. if (carrying_corpse == true) { //Get new destination if (barion.is_selected) { if (barion.GetMovement(ref destination)) { barion.agent.SetDestination(destination); } } //Update corpse position Vector3 pos = barion.transform.position; corpse.transform.position = new Vector3(pos.x, corpse_height, pos.z); if (drop_corpse == true) { DropCorpse(); } } }
public void UpdateState() { //If it's not selected no action is performed if (barion.is_selected == false) { return; } //Can transition to walking if (barion.GetMovement(ref destination)) { ToWalkingState(); } //Can transition to moving box if (barion.target_box != null) { ToMoveBoxState(); } if (barion.target_corpse != null) { ToCarryCorpseState(); } //Invisible sphere ability (ability1) if (Input.GetAxis("Ability1") != 0 && barion.cooldown_inst.AbilityIsReady(1)) { ToInvisibleSphereState(); return; } //Invisible sphere ability (ability1) if (Input.GetAxis("Ability2") != 0 && barion.cooldown_inst.AbilityIsReady(2)) { ToShieldState(); return; } }
public void UpdateState() { //Check arrive at box if (hiding == false) { if (barion.DstArrived()) { Hide(); } } else { //Actually hiding barion.transform.position = new Vector3(box.transform.position.x, barion.transform.position.y, box.transform.position.z); //Update position with box if (barion.is_selected) { if (barion.GetMovement(ref destination)) //Get movement input { GetOut(); //Get out the box } } } }
public void UpdateState() { //Check arrive destination if (barion.DstArrived()) { ToIdleState(); } //Actions performed when Barion is selected if (barion.is_selected) { //Check new input movement if (barion.GetMovement(ref destination)) { ToWalkingState(); } //Can transition to moving box if (barion.target_box != null) { ToMoveBoxState(); } if (Input.GetAxis("Ability1") != 0 && barion.cooldown_inst.AbilityIsReady(1)) { ToInvisibleSphereState(); return; } //Invisible sphere ability (ability1) if (Input.GetAxis("Ability2") != 0 && barion.cooldown_inst.AbilityIsReady(2)) { ToShieldState(); return; } } }