public void Update() { base.Update(); // Player movement is hard coded to the update loop of player // Up/Down is locked together. One or the other only direction = Vector2.zero; base.animator.SetBool("Walking", false); if (Input.GetKey(KeyCode.W)) { direction.y = 1; base.animator.SetBool("Walking", true); } else if (Input.GetKey(KeyCode.S)) { direction.y = -1; base.animator.SetBool("Walking", true); } // Similar locking between to Left/Right if (Input.GetKey(KeyCode.A)) { direction.x = -1; base.animator.SetInteger("Direction", 1); base.animator.SetBool("Walking", true); } else if (Input.GetKey(KeyCode.D)) { direction.x = 1; base.animator.SetInteger("Direction", 3); base.animator.SetBool("Walking", true); } if (direction != Vector2.zero) { facing = direction; } RigidBody.velocity = direction.normalized * gSpeed; // do the atatack if (canAttack && (Input.GetButtonDown("Jump") || Input.GetButtonDown("Fire1"))) { Attack(); } if (Input.GetKey(KeyCode.P) && false) { if (Random.Range(0f, 1f) > 0.5f) { Army.AddUnit(ArmyManager.Troop.Knight); } else { Army.AddUnit(ArmyManager.Troop.Archer); } } }