// Update is called once per frame void Update() { //if (!isLocalPlayer) //{ // return; //} if (turnManager.executing == TurnManager.Executing._True) { return; } if (turnManager.turn) { timer += Time.deltaTime; if (Input.GetButton("Fire2") && timer >= timeBetweenBombs && Time.timeScale != 0) { //PlaceBomb(); turnManager.AddActionToList(TurnManager.ActionType._Bomb, transform.position, bombActionCost); } //if (timer >= timeBetweenBullets * effectsDisplayTime) //{ // DisableEffects(); //} } }
void Move(float h, float v) { tempMovement.Set(h, 0f, v); // create new action whenever ghost changes direction. set the type to a move action and give final position if (movement.normalized != tempMovement.normalized && movement.magnitude != 0f) { // Debug.Log("Making new action"); turnManager.AddActionToList(TurnManager.ActionType._Move, transform.position, currentCost); currentCost = 0; } movement.Set(h, 0f, v); movement = movement.normalized * speed * Time.deltaTime; float tempCost = currentCost + movement.magnitude * moveActionCost; float managerCost = turnManager.GetCurrentActionCost(); // if this movement won't put the player over the maximum turn cost, move if (managerCost + tempCost <= turnManager.maxActions) { playerRigidbody.MovePosition(transform.position + movement); currentCost = tempCost; turnManager.DisplayActionCostSlider(currentCost); } //else //{ // // otherwise scale the movement to fit // float scale = turnManager.maxActions - managerCost; // playerRigidbody.MovePosition(transform.position + movement.normalized * scale); //} }