// Update is called once per frame void Update() { if (Time.deltaTime == 0 || (GameControllerCommon.instance != null && GameControllerCommon.instance.gameState != GameState.PLAYING) || PauseMenu.isPaused) { return; } if (!jumpPressed) { jumpPressed = Input.GetButtonDown("Jump"); } if (!dashPressed) { dashPressed = Input.GetButtonDown("AirDash"); } crouchPressed = Input.GetButton("Crouch"); Vector3 camForward = GlobalPlayerController.GetForwardRelativeToCamera(); Vector3 camRight = new Vector3(camForward.z, 0f, -camForward.x); Vector3 movementX = camRight * Input.GetAxis("Horizontal"); Vector3 movementZ = camForward * Input.GetAxis("Vertical"); moveDirection = (movementX + movementZ); moveDirection = Vector3.ClampMagnitude(moveDirection, 1f); }
public void RpcClientDeactivatePlayer(NetworkIdentity player) { GlobalPlayerController gpc = player.GetComponent <GlobalPlayerController>(); gpc.DisableAllControls(); gpc.enabled = false; }
// Update is called once per frame new void Update() { if (gpc == null) { if (GlobalPlayerController.localInstance != null) { gpc = GlobalPlayerController.localInstance; gpc.DisableAllControls(); gpc.enabled = false; localAnimatorCutscene.Play(); } else { //This should not move until the player exists return; } } base.Update(); if (gameState == GameState.PLAYING) { timerSeconds += Time.deltaTime; } if (gameState == GameState.ENDED) { gpc.DisableAllControls(); gpc.enabled = false; } }
// Start is called before the first frame update void Awake() { col = GetComponent <CapsuleCollider>(); gpc = GetComponent <GlobalPlayerController>(); rb = GetComponent <Rigidbody>(); model = transform.Find("Model").gameObject; currentMaxSpeed = defaultRunSpeed; }
void Start() { aimCam = GameObject.FindGameObjectWithTag("AimCamera").GetComponent <CinemachineVirtualCamera>(); lookAtTarget = GameObject.FindGameObjectWithTag("LookAtTarget").transform; gpc = GetComponent <GlobalPlayerController>(); dpc = GetComponent <DefaultPlayerController>(); isAiming = false; }
public void DeactivateAllPlayers() { foreach (NetworkIdentity player in scoreboard.Keys) { GlobalPlayerController gpc = player.gameObject.GetComponent <GlobalPlayerController>(); DeactivatePlayer(gpc); } }
public void RpcClientActivatePlayer(NetworkIdentity player) { Debug.Log("Activating " + player); GlobalPlayerController gpc = player.GetComponent <GlobalPlayerController>(); gpc.enabled = true; gpc.EnableDefaultControls(); }
void TryFindDefaultPlayerTarget() { if (GlobalPlayerController.localInstance != null) { gpc = GlobalPlayerController.localInstance; ic = gpc.GetComponent <ItemController>(); } }
private void AdjustOnNewScene() { if (GlobalPlayerController.CheckPositionsKey(_currentSceneName)) { Vector2 previousPosition = GlobalPlayerController.GetPosition(_currentSceneName); _rigidbody2d.MovePosition(previousPosition + _lookDirection); } _hasAdjusted = true; }
// Start is called before the first frame update void Awake() { globalPlayerController = GetComponent <GlobalPlayerController>(); rb = GetComponent <Rigidbody>(); cc = GetComponent <CapsuleCollider>(); isReversed = false; currentGrindSpeed = grindSpeed; grindCooldownActive = false; }
void TryFindDefaultPlayerTarget() { if (GlobalPlayerController.localInstance != null) { gpc = GlobalPlayerController.localInstance; rb = gpc.gameObject.GetComponent <Rigidbody>(); playerHealth = gpc.gameObject.GetComponent <PlayerHealth>(); grind = gpc.gameObject.GetComponent <GrindPlayerController>(); } }
// Start is called before the first frame update void Start() { isRightWall = false; gpc = transform.parent.GetComponent <GlobalPlayerController>(); animator = GetComponent <Animator>(); rb = transform.parent.GetComponent <Rigidbody>(); cc = transform.parent.GetComponent <CapsuleCollider>(); itemController = transform.parent.GetComponent <ItemController>(); StartCoroutine(AddConstraints()); //Because the ic hasnt added the lookAt itself, it seems }
// Start is called before the first frame update void Awake() { gpc = GetComponent <GlobalPlayerController>(); rb = GetComponent <Rigidbody>(); wallNormal = new Vector3(0, 0, 0); wallRunDirection = new Vector3(0, 0, 0); currentWallRunDuration = wallRunDuration; isWallRunning = false; wallsCollidingWith = new List <GameObject>(); isRunningOnRightWall = false; }
// Start is called before the first frame update void Awake() { gpc = GetComponent <GlobalPlayerController>(); rb = GetComponent <Rigidbody>(); wpc = GetComponent <WallPlayerController>(); capsuleCollider = GetComponent <CapsuleCollider>(); currentHealth = maxHealth; timeSinceLastFallDamage = healthRegenTime; Checkpoint.playerCheckpointMap[this.gameObject] = transform.position; deathVelocity = new Vector3(0, 0, 0); }
public void ReceiveSelection() { if (_isActive && !_isChoosing) { advanceDialogue(); } if (_isChoosing && _remainingCharacters < 1) { _choice.MakeChoice(_currentSelection); GlobalPlayerController.AddDecision(_choice); EndDialogue(); } }
public override void OnStartLocalPlayer() { base.OnStartLocalPlayer(); if(localInstance == null && this.isLocalPlayer) { localInstance = this; //Debug.Log("Local player singleton is set"); } //Somehow another player is the localplayer on the same client if(localInstance != null && localInstance.isLocalPlayer && this.isLocalPlayer && this != localInstance) { Debug.Log("Something went wrong, deleting this player."); Destroy(this.gameObject); } }
private void MovePlayer() { if (_hasAdjusted) { Vector2 position = _rigidbody2d.position; int sprint = 0; if (_isSprinting) { sprint = 1; } position += _moveDirection * _speed * (1 + sprint * _sprintFactor); _rigidbody2d.MovePosition(position); GlobalPlayerController.SetPosition(_currentSceneName, _rigidbody2d.position); } }
void Update() { if (Input.GetKeyDown(KeyCode.E)) { _interactor.Interact(); } if (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.LeftShift)) { _movement.ToggleSprint(); } AxisInput(); if (Input.GetKeyDown(KeyCode.Space)) { GlobalPlayerController.PrintDecisions(); } if (Input.GetKeyDown(KeyCode.I)) { _inventoryGui.ToggleGui(); } }
void Start() { GlobalPlayerController.ReDestroyObjects(); }
// Start is called before the first frame update void Start() { gpc = transform.parent.GetComponent <GlobalPlayerController>(); canPlaySound = true; }
public void DeactivatePlayer(GlobalPlayerController player) { player.DisableAllControls(); player.enabled = false; RpcClientDeactivatePlayer(player.GetComponent <NetworkIdentity>()); }
public void ActivatePlayer(GlobalPlayerController player) { player.enabled = true; player.EnableDefaultControls(); RpcClientActivatePlayer(player.GetComponent <NetworkIdentity>()); }
public void SelfDestruct() { Destroy(gameObject); GlobalPlayerController.SetDestroy(_position, true); }