public PlayerConfig(PlayerInput pi) { Input = pi; Index = pi.playerIndex; InputHandler = pi.gameObject.GetComponent <PlayerInputHandler>(); IsReady = false; }
// Handle the player's death void Kill() { Debug.Log("killed"); isDead = true; if (OnDeath != null) { OnDeath.Invoke(); } if (Equals(this.gameObject.tag, "Player")) { // Disable any character control PlayerInputHandler inputHandler = GetComponent <PlayerInputHandler>(); inputHandler.PlayerActionsEnabled = false; inputHandler.PlayerMovementEnabled = false; // TODO: Play the death animation respawnManager.RespawnPlayer(CharacterPrefab); } else { Destroy(this.gameObject); } }
void Start() { // fetch components on the same gameObject m_Controller = GetComponent <CharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController>(m_Controller, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject); m_WeaponsManager = GetComponent <PlayerWeaponsManager>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerWeaponsManager, PlayerCharacterController>(m_WeaponsManager, this, gameObject); m_Health = GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerCharacterController>(m_Health, this, gameObject); m_Actor = GetComponent <Actor>(); DebugUtility.HandleErrorIfNullGetComponent <Actor, PlayerCharacterController>(m_Actor, this, gameObject); volume = Camera.main.GetComponent <PostProcessVolume>(); m_Controller.enableOverlapRecovery = true; m_Health.onDie += OnDie; // force the crouch state to false when starting SetCrouchingState(false, true); UpdateCharacterHeight(true); hasGlasses = false; }
void Start() { // fetch components on the same gameObject m_Controller = GetComponent <CharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController>(m_Controller, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject); m_WeaponsManager = GetComponent <PlayerWeaponsManager>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerWeaponsManager, PlayerCharacterController>(m_WeaponsManager, this, gameObject); m_PlayerUpgradeManager = GetComponent <PlayerUpgradeManager>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerUpgradeManager, PlayerCharacterController>(m_PlayerUpgradeManager, this, gameObject); m_Health = GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerCharacterController>(m_Health, this, gameObject); m_Controller.enableOverlapRecovery = true; m_Health.onDie += OnDie; if (isInvincible) { m_Health.invincible = true; } // force the crouch state to false when starting SetCrouchingState(false, true); UpdateCharacterHeight(true); isDead = false; }
void Start() { timerActive = true; checkpoints.Add(transform.position); v.profile.TryGetSettings(out lensdis); v.profile.TryGetSettings(out vignett); v.profile.TryGetSettings(out chrome); // fetch components on the same gameObject m_Controller = GetComponent <CharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController>(m_Controller, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject); wallRunComponent = GetComponent <WallRun>(); m_Controller.enableOverlapRecovery = true; // force the crouch state to false when starting SetCrouchingState(false, true); UpdateCharacterHeight(true); }
void Start() { // fetch components on the same gameObject //同じgameObjectでコンポーネントをフェッチします m_Controller = GetComponent <CharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController>(m_Controller, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject); m_WeaponsManager = GetComponent <PlayerWeaponsManager>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerWeaponsManager, PlayerCharacterController>(m_WeaponsManager, this, gameObject); m_Health = GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerCharacterController>(m_Health, this, gameObject); m_Actor = GetComponent <Actor>(); DebugUtility.HandleErrorIfNullGetComponent <Actor, PlayerCharacterController>(m_Actor, this, gameObject); m_Controller.enableOverlapRecovery = true; m_Health.onDie += OnDie; // force the crouch state to false when starting //開始時にクラウチの状態をfalseに強制します SetCrouchingState(false, true); UpdateCharacterHeight(true); }
// Start is called before the first frame update void Start() { m_Monolith = transform.Find("Monolith").gameObject; m_PlayerController = player.GetComponent <PlayerCharacterController>(); m_InputHandler = player.GetComponent <PlayerInputHandler>(); blackOverlay.canvasRenderer.SetAlpha(0.0f); }
// Use this for initialization void Start() { playerInputHandler = this.gameObject.AddComponent <PlayerInputHandler>(); playerMovementHandler = this.gameObject.AddComponent <PlayerMovementHandler>(); playerAnimationHandler = this.gameObject.AddComponent <PlayerAnimationHandler>(); playerShieldHandler = GetComponent <PlayerShieldHandler>(); }
private void Start() { activeWeaponIndex = -1; m_WeaponSwitchState = WeaponSwitchState.Down; m_InputHandler = GetComponent <PlayerInputHandler> (); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerWeaponsManager> (m_InputHandler, this, gameObject); m_PlayerCharacterController = GetComponent <PlayerCharacterController> (); DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerWeaponsManager> (m_PlayerCharacterController, this, gameObject); m_PlayerWalkController = GetComponent <PlayerWalkController> (); DebugUtility.HandleErrorIfNullGetComponent <PlayerWalkController, PlayerWeaponsManager> (m_PlayerWalkController, this, gameObject); SetFOV(defaultFOV); onSwitchedToWeapon += OnWeaponSwitched; // Add starting weapons foreach (var weapon in startingWeapons) { AddWeapon(weapon); } SwitchWeapon(true); }
void Start() { //TODO Player spawned based on lanes //Instantiate the car and set up the components necessary for input etc. GameObject playerCar = Instantiate(playerCarPrefab, new Vector3(0f, 0.5f, -10f), Quaternion.identity) as GameObject; lightController.PlayerSpotlight = playerCar.GetComponentInChildren <Light> (); playerCarObj = playerCar; inputHandler = playerCar.GetComponent <PlayerInputHandler> (); //Set the transforms for the playerCam and currentCam for use in the Change camera functions playerCamTransform = playerCamera.transform; currentCamTransform = introCam; cameraChangeTime = 1.0f; gameStartTime = Time.time; //Keeping track of the zone time etc. /********** * BuddyCheck here for DoomSayer * /*********/ foreach (PlayerBuddy buddy in playerBuddies) { if (buddy.buddyCheck(BuddySkillEnum.Doomsayer)) { player_isUsingDoomsayer = true; buddy_doomsayerFrequency = buddy.doomsayer_speechBubbleFrequency; buddy_doomsayerTimeUntilNext = buddy.doomsayer_speechBubbleFrequency; } } //Start the scene by zooming out from the car StartCoroutine(startIntro(topCam)); }
/// <summary> /// Creates the Bubble Jump Power Command /// </summary> /// <param name="PowerUser">Object which uses the power</param> public BubbleJumpPowerCommand (GameObject PowerUser) { CC2D = PowerUser.GetComponent<CharacterController2D>(); PIH = PowerUser.GetComponent<PlayerInputHandler>(); A = PowerUser.GetComponent<Animator>(); BB = PowerUser.GetComponent<ButtBubbles>(); }
void Start() { m_PlayerInputsHandler = FindObjectOfType <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullFindObject <PlayerInputHandler, InGameMenuManager>(m_PlayerInputsHandler, this); m_PlayerHealth = m_PlayerInputsHandler.GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, InGameMenuManager>(m_PlayerHealth, this, gameObject); m_FramerateCounter = FindObjectOfType <FramerateCounter>(); DebugUtility.HandleErrorIfNullFindObject <FramerateCounter, InGameMenuManager>(m_FramerateCounter, this); menuRoot.SetActive(false); lookSensitivitySlider.value = m_PlayerInputsHandler.lookSensitivity; lookSensitivitySlider.onValueChanged.AddListener(OnMouseSensitivityChanged); shadowsToggle.isOn = QualitySettings.shadows != ShadowQuality.Disable; shadowsToggle.onValueChanged.AddListener(OnShadowsChanged); invincibilityToggle.isOn = m_PlayerHealth.invincible; invincibilityToggle.onValueChanged.AddListener(OnInvincibilityChanged); framerateToggle.isOn = m_FramerateCounter.uiText.gameObject.activeSelf; framerateToggle.onValueChanged.AddListener(OnFramerateCounterChanged); }
void Start() { // fetch components on the same gameObject m_Controller = GetComponent <CharacterController>(); // DebugUtility.HandleErrorIfNullGetComponent<CharacterController, PlayerCharacterController>(m_Controller, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); // DebugUtility.HandleErrorIfNullGetComponent<PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject); m_WeaponsManager = GetComponent <PlayerWeaponsManager>(); // DebugUtility.HandleErrorIfNullGetComponent<PlayerWeaponsManager, PlayerCharacterController>(m_WeaponsManager, this, gameObject); m_Health = GetComponent <Health>(); // DebugUtility.HandleErrorIfNullGetComponent<Health, PlayerCharacterController>(m_Health, this, gameObject); m_Actor = GetComponent <Actor>(); // DebugUtility.HandleErrorIfNullGetComponent<Actor, PlayerCharacterController>(m_Actor, this, gameObject); m_Animator = GetComponent <Animator>(); network = GameObject.FindObjectOfType <NetworkSocket1>(); m_Controller.enableOverlapRecovery = true; m_Health.onDie += OnDie; // force the crouch state to false when starting SetCrouchingState(false, true); UpdateCharacterHeight(true); }
void Start() { input = GetComponent <PlayerInputHandler>(); characterController = GetComponent <PlayerCharacterController>(); input.OnMeleeInputDown.AddListener(MeleeAttack); }
void Start() { // fetch components on the same gameObject m_Controller = GetComponent <CharacterController>(); //Important //DebugUtility.HandleErrorIfNullGetComponent<CharacterController, PlayerCharacterController>(m_Controller, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); //Important // DebugUtility.HandleErrorIfNullGetComponent<PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject); m_WeaponsManager = GetComponent <PlayerWeaponsManager>(); //Important ps tout suite //DebugUtility.HandleErrorIfNullGetComponent<PlayerWeaponsManager, PlayerCharacterController>(m_WeaponsManager, this, gameObject); m_Health = GetComponent <Health>(); //Important //DebugUtility.HandleErrorIfNullGetComponent<Health, PlayerCharacterController>(m_Health, this, gameObject); //m_Actor = GetComponent<Actor>(); //DebugUtility.HandleErrorIfNullGetComponent<Actor, PlayerCharacterController>(m_Actor, this, gameObject); m_Controller.enableOverlapRecovery = true; m_Health.onDie += OnDie; // force the crouch state to false when starting SetCrouchingState(false, true); //Important UpdateCharacterHeight(true); //Important }
/// <summary> /// Creates the Bubble Jump Power Command /// </summary> /// <param name="PowerUser">Object which uses the power</param> public BubbleJumpPowerCommand(GameObject PowerUser) { CC2D = PowerUser.GetComponent <CharacterController2D>(); PIH = PowerUser.GetComponent <PlayerInputHandler>(); A = PowerUser.GetComponent <Animator>(); BB = PowerUser.GetComponent <ButtBubbles>(); }
void Start() { // fetch components on the same gameObject m_Controller = GetComponent <CharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController>(m_Controller, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject); m_WeaponsManager = GetComponent <PlayerWeaponsManager>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerWeaponsManager, PlayerCharacterController>(m_WeaponsManager, this, gameObject); m_Health = GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerCharacterController>(m_Health, this, gameObject); m_Actor = GetComponent <Actor>(); DebugUtility.HandleErrorIfNullGetComponent <Actor, PlayerCharacterController>(m_Actor, this, gameObject); wallRunComponent = GetComponent <WallRun>(); m_Controller.enableOverlapRecovery = true; m_Health.onDie += OnDie; //defualt state state = State.Normal; // force the crouch state to false when starting SetCrouchingState(false, true); UpdateCharacterHeight(true); }
void FetchPlayer() { GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject player in players) { PlayerInputHandler playerInput = player.GetComponent <PlayerInputHandler>(); if (playerInput != null) //players should always have a player input components { if (playerInput.controllerNumber == playerNumber) { target = player.GetComponent <StatsHandler>(); if (target == null) { Debug.Log("ERROR - Player " + playerNumber + " does not have a StatsHandler!"); } } } else { Debug.Log("ERROR - Player does not have an input component!"); } } }
void Start() { // fetch components on the same gameObject m_Controller = GetComponent <CharacterController>(); DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController>(m_Controller, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject); m_WeaponsManager = GetComponent <PlayerWeaponsManager>(); DebugUtility.HandleErrorIfNullGetComponent <PlayerWeaponsManager, PlayerCharacterController>(m_WeaponsManager, this, gameObject); m_Health = GetComponent <Health>(); DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerCharacterController>(m_Health, this, gameObject); m_Actor = GetComponent <Actor>(); DebugUtility.HandleErrorIfNullGetComponent <Actor, PlayerCharacterController>(m_Actor, this, gameObject); m_Controller.enableOverlapRecovery = true; m_Health.onDie += OnDie; stanceHUD = GameObject.Find("GameManager/GameHUD").GetComponent <StanceHUD>(); CameraGameObject = GameObject.FindGameObjectWithTag("MainCamera"); playerCamera = CameraGameObject.GetComponent <Camera>(); // force the crouch state to false when starting SetCrouchingState(false, false, true); UpdateCharacterHeight(true); }
// Use this for initialization void Start() { handler = this; body = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); t = GetComponent <Transform>(); }
void Start() { // Add key types to key dictionary foreach (Key.KeyType key in Enum.GetValues(typeof(Key.KeyType))) { keys.Add(key, 0); } // fetch components on the same gameObject m_Controller = GetComponent <CharacterController>(); m_InputHandler = GetComponent <PlayerInputHandler>(); playerFootstepEmitter = GetComponent <PlayerFootstepEmitter>(); m_Controller.enableOverlapRecovery = true; // force the crouch state to false when starting SetCrouchingState(false, true); UpdateCharacterHeight(true); // disable interaction prompt until we need it. interactText.text = "You aren't supposed to see this text!"; interactText.gameObject.SetActive(false); keyCountText.text = "0"; keyCountText.gameObject.SetActive(false); }
void Start() { // fetch components on the same gameObject m_Controller = GetComponent <CharacterController> (); DebugUtility.HandleErrorIfNullGetComponent <CharacterController, PlayerCharacterController> (m_Controller, this, gameObject); m_ClimbController = GetComponent <PlayerClimbController> (); DebugUtility.HandleErrorIfNullGetComponent <PlayerClimbController, PlayerCharacterController> (m_ClimbController, this, gameObject); m_WalkController = GetComponent <PlayerWalkController> (); DebugUtility.HandleErrorIfNullGetComponent <PlayerWalkController, PlayerCharacterController> (m_WalkController, this, gameObject); m_InputHandler = GetComponent <PlayerInputHandler> (); DebugUtility.HandleErrorIfNullGetComponent <PlayerInputHandler, PlayerCharacterController> (m_InputHandler, this, gameObject); m_WeaponsManager = GetComponent <PlayerWeaponsManager> (); DebugUtility.HandleErrorIfNullGetComponent <PlayerWeaponsManager, PlayerCharacterController> (m_WeaponsManager, this, gameObject); m_Health = GetComponent <Health> (); DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerCharacterController> (m_Health, this, gameObject); m_Actor = GetComponent <Actor> (); DebugUtility.HandleErrorIfNullGetComponent <Actor, PlayerCharacterController> (m_Actor, this, gameObject); mainCamera = Camera.main; interactionText = GameObject.Find("InteractionCanvas/InteractionText").GetComponent <Text> (); m_Health.onDie += OnDie; // force the crouch state to false when starting SetCrouchingState(false, true); }
public void SetInputHandler(PlayerInputHandler inp) { input = inp; if (inGame) { input.SetInputBlock(false); } }
void Start() { m_Actor = GetComponent <Actor>(); m_Controller = GetComponent <CharacterController>(); m_InputHandler = GetComponent <PlayerInputHandler>(); m_Controller.enableOverlapRecovery = true; UpdateCharacterHeight(true); }
private void Start() { cvc = GameObject.Find("Player Camera").GetComponent <CinemachineVirtualCamera>(); inputHandler = GetComponent <PlayerInputHandler>(); levelLoader = FindObjectOfType <LevelLoader>(); }
void Start() { characterController = GetComponent <CharacterController>(); m_InputHandler = GetComponent <PlayerInputHandler>(); // Lock cursor Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
//protected FSM locomotionFsm; public PlayerState(PlayerController playerEntity) { this.playerEntity = playerEntity; playerInput = playerEntity.PlayerInputHandler; controller2D = playerEntity.controller2D; playerMove = playerEntity.playerMoveProperties; }
// Start is called before the first frame update void Start() { m_ShotSound = GetComponent <AudioSource>(); m_InputHandler = GetComponent <PlayerInputHandler>(); m_RigidBody2D = GetComponent <Rigidbody2D>(); m_wantsToShoot = false; nextFire = 0.0f; }
private void Start() { rb = GetComponent <Rigidbody2D>(); input = GetComponent <PlayerInputHandler>(); sprite = GetComponent <SpriteRenderer>(); animator = GetComponent <Animator>(); input.OnRollInputDown.AddListener(TryRoll); }
void Start() { inputHandler = new PlayerInputHandler( new CommandMove(0, Definition.ONE_BLOCK_DIST), new CommandMove(-1 * Definition.ONE_BLOCK_DIST, 0), new CommandMove(Definition.ONE_BLOCK_DIST, 0), new CommandMove(0, -1 * Definition.ONE_BLOCK_DIST) ); }
// Start is called before the first frame update void Start() { CurrentAmmo = ClipSize; //automatically set player's ammo as full at the start input = GetComponent <PlayerInputHandler>(); characterController = GetComponent <PlayerCharacterController>(); animator = GetComponent <Animator>(); input.OnShootInputDown.AddListener(TryShoot); }
protected override void Initialize() { // TODO: Add your initialization logic here AssetBufferer.BufferImages(this.Content); this.character = new CharacterEntity(this.GraphicsDevice); this.characterAnimator = new CharacterAnimator(this.character); this.inputHandler = new PlayerInputHandler(this.character); this.fallingStuffAnimator = new FallingStuffAnimator(); this.collisionHandler = new CollisionHandler(this.character, this.fallingStuffAnimator.fallingEntites); this.graphics.PreferredBackBufferWidth = Globals.GLOBAL_WIDTH; this.graphics.PreferredBackBufferHeight = Globals.GLOBAL_HEIGHT; this.graphics.ApplyChanges(); base.Initialize(); }
/// <summary> /// Creates the Bubble Jump Power Command /// </summary> /// <param name="PowerUser">Object which uses the power</param> public SugarBrickPowerCommand(GameObject PowerUser) { CC2D = PowerUser.GetComponent<CharacterController2D>(); PIH = PowerUser.GetComponent<PlayerInputHandler>(); }
// Use this for initialization void Start () { playerRef = GameObject.FindGameObjectWithTag("Player"); rotTarget.rotation = playerRef.transform.rotation; InputHandler = playerRef.GetComponent<PlayerInputHandler>(); bNeedsReset = false; }
public void Use(PlayerInputHandler playerInputHandler) { _playerInputHandler = playerInputHandler; _isUsing = true; }
// Use this for initialization void Start () { InputHandler = GetComponent<PlayerInputHandler>(); controller = GetComponentInChildren<CharacterController>(); }
/// <summary> /// Creates the Candy Spitting Power Command /// </summary> /// <param name="PowerUser">Object which uses the power</param> public CandySpittingPowerCommand(GameObject PowerUser) { CC2D = PowerUser.GetComponent<CharacterController2D>(); PIH = PowerUser.GetComponent<PlayerInputHandler>(); }