void Awake() { _rgb = GetComponent <Rigidbody2D>(); _ray = GetComponent <Raycaster2D>(); _moves = GetComponent <PlayerMove>(); _jump = GetComponent <JumpController>(); }
/// <summary> /// コントローラの初期化 /// </summary> private void initCatController() { playerMoveController = GameObject.Find(PathMaster.CAT_MOVE_CONTROLLER).GetComponent <PlayerMoveController>(); jumpController = GameObject.Find(PathMaster.JUMP_CONTROLLER).GetComponent <JumpController>(); dashSkillController = GameObject.Find(PathMaster.DASH_SKILL_CONTROLLER).GetComponent <CatSkillController>(); decoySkillController = GameObject.Find(PathMaster.DECOY_SKILL_CONTROLLER).GetComponent <CatSkillController>(); smokeSkillController = GameObject.Find(PathMaster.SMOKE_SKILL_CONTROLLER).GetComponent <CatSkillController>(); mainCamera = Camera.main; cameraAnimator = mainCamera.GetComponent <Animator>(); CameraController cameraController = mainCamera.GetComponent <CameraController>(); cameraController.Player = this.gameObject; cameraController.InitCameraController(); this.FixedUpdateAsObservable() .Subscribe(x => playerBehavior()); this.FixedUpdateAsObservable() .Where(x => jumpController.GetJumpable()) .Subscribe(_ => catJump()); this.FixedUpdateAsObservable() .Where(x => dashSkillController.GetSkillUsable()) .Subscribe(_ => useDashSkill()); this.FixedUpdateAsObservable() .Where(x => decoySkillController.GetSkillUsable()) .Subscribe(_ => useDecoySkill()); this.FixedUpdateAsObservable() .Where(x => smokeSkillController.GetSkillUsable()) .Subscribe(_ => useSmokeSkill()); }
void Awake() { // initialize all controllers in Awake() to make sure no collisions occur before controllers can handle them this.jumpController = gameObject.GetComponent <JumpController>(); this.movementController = gameObject.GetComponent <MovementController>(); this.fightMoveController = gameObject.GetComponent <FightMoveController>(); }
/** * 控制角色移动 * */ void Move() { float moveSpeed = soldierSetting.runSpeed; // 判断角色状态 if (playerInput.IsWalking) { moveSpeed = soldierSetting.walkSpeed; } else if (playerInput.IsCrouched) { moveSpeed = soldierSetting.crouchedSpeed; } if (playerInput.IsJumped) { JumpController.jump(); Debug.Log("is jump"); } Vector2 direction = new Vector2(playerInput.Vertical * moveSpeed, playerInput.Horizontal * moveSpeed); CharacterController.SimpleMove(transform.forward * direction.x + transform.right * direction.y); //print(Vector3.Distance(transform.position, previousPosition)); if (Vector3.Distance(transform.position, previousPosition) > minimumMoveTreshold) { footSteps.Play(); //print("play"); } previousPosition = transform.position; }
// Use this for initialization void Start() { pc = GetComponent <PlayerController>(); //for passing along information about grapples hitting rb = GetComponent <Rigidbody>(); //for actually changing the velocity jc = GetComponent <JumpController>(); //for checking grounded state, in case a grapple scrapes the ground grappleToVelocityDirection.eulerAngles = new Vector3(0, 0, 270); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); initialGravity = rb.gravityScale; jumpController = GetComponent <JumpController>(); animator = GetComponent <Animator>(); }
public void ProcessInputs(bool grounded, bool jumpButtonPressed, JumpController jumpController) { if (grounded && jumpController.rigidbody.velocity.y <= 0) { jumpController.currentJumpState = jumpController.groundedState; } }
/** * 控制角色跳跃 * */ void Jump() { if (playerInput.IsJumped) { JumpController.jump(); Debug.Log("is jump"); } }
private void Awake() { rewiredPlayer = ReInput.players.GetPlayer(rewiredPlayerId); controller = GetComponent <Controller2D>(); movementController = GetComponent <MovementController>(); jumpController = GetComponent <JumpController>(); standardAttack = GetComponentInChildren <PlayerAttackInfo>(); teleportAttack = GetComponentInChildren <PlayerTeleportAttack>(); animatorController = GetComponent <AnimatorController>(); }
private void Start() { MessageKit.addObserver(EventTypes.JUMP_INPUT_DOWN, OnJumpInputDown); controller = GetComponent <Controller2D>(); gravityController = GetComponent <GravityController>(); movementController = GetComponent <MovementController>(); jumpController = GetComponent <JumpController>(); animController = GetComponent <AnimatorController>(); playerAudio = GetComponent <PlayerAudio>(); }
public override void ActivateEvent() { foreach (GameObject player in players) { JumpController jump = player.GetComponent <JumpController>(); player.GetComponent <Rigidbody2D>().gravityScale = -1 * player.GetComponent <Rigidbody2D>().gravityScale; jump.jumpForce = jump.jumpForce * -1; jump.groundCheck.localPosition = new Vector3(jump.groundCheck.localPosition.x, -1 * jump.groundCheck.localPosition.y, jump.groundCheck.localPosition.z); player.GetComponent <Player>().currentEvent = eventName; } }
void Start() { gmc = GetComponent <GrappleMovementController>(); lr = GetComponent <LineRenderer>(); lr.enabled = false; jc = GetComponent <JumpController>(); gpc = grappleHookProjectile.GetComponent <GrappleProjectileController>(); InputManager.instance.OnMoveLeftDown += () => { forwardIsRight = false; }; InputManager.instance.OnMoveRightDown += () => { forwardIsRight = true; }; InputManager.instance.OnGrappleDown += () => { fireGrapple(!forwardIsRight); }; InputManager.instance.OnGrappleUp += () => { releaseGrapple(); }; }
private bool isResetting; //是否正在重置 void Start() { cf = GameObject.Find("Main Camera").GetComponent <CameraFollow>(); jc = GameObject.Find("Ball").GetComponent <JumpController>(); ball = GameObject.Find("Ball"); ChangeLevel(PlayerPrefs.GetInt("level")); for (int i = 0; i < resetFX.Length; i++) { resetFX[i].Stop(); } isResetting = false; }
public void InitializeMe() { sensory = gameObject.GetComponent<AnimalSensory>(); body = gameObject.GetComponent<AnimalBody>(); brain = gameObject.GetComponent<AnimalBrain>(); stateMachine = gameObject.GetComponent<AnimalStateMachine>(); possesor = GameObject.FindGameObjectWithTag("Player").GetComponent<PhantomController>(); moveSpeed = body.moveSpeed; isInitialized = true; if(stateMachine.myType == AnimalType.prairieDog) jumpController = gameObject.GetComponent<JumpController>(); }
public override void DeactivateEvent() { eventSpawner.spawnedEvents.Remove(eventName); foreach (GameObject player in players) { JumpController jump = player.GetComponent <JumpController>(); player.GetComponent <Rigidbody2D>().gravityScale = -1 * player.GetComponent <Rigidbody2D>().gravityScale; jump.jumpForce = jump.jumpForce * -1; jump.groundCheck.localPosition = new Vector3(jump.groundCheck.localPosition.x, -1 * jump.groundCheck.localPosition.y, jump.groundCheck.localPosition.z); player.GetComponent <Player>().currentEvent = ""; DestroyObject(gameObject); } }
private void Awake() { // Players local save for starting game object its controlling. HandleNewControlledObject(); if (LevelController.Instance) { LevelController.Instance.PlayerController = this; } PerkController = GetComponent <PerkController>(); jumpController = GetComponent <JumpController>(); }
#pragma warning disable CS0108 // O membro oculta o membro herdado; palavra-chave new ausente private void Awake() #pragma warning restore CS0108 // O membro oculta o membro herdado; palavra-chave new ausente { base.Awake(); jump = GetComponent <JumpController>(); input = new InputController(); movement.Speed = WalkingSpeed; movement.ClimbSpeed = ClimbingSpeed; jump.JumpSpeed = JumpingSpeed; health.HP = HP; health.maxHP = HP; }
// Use this for initialization void Start() { manager = GameObject.Find("IroIroManager"); if (cheatMode) { manager.GetComponent <ScoreController>().ShowCanvas(true); } rb = this.GetComponent <Rigidbody>(); _smoke1 = smoke1.emission; _smoke2 = smoke2.emission; jc = this.GetComponent <JumpController>(); }
// Start is called before the first frame update void Start() { hearths = intialhearts; rb = GetComponent <Rigidbody2D>(); staminaSlider = GameObject.FindGameObjectWithTag("Stamina"); experienceSlider = GameObject.FindGameObjectWithTag("Experience"); sprites = gameObject.GetComponentsInChildren <SpriteRenderer>(); inventory = gameObject.GetComponent <InventoryController>(); animator = gameObject.GetComponent <Animator>(); previousGravity = rb.gravityScale; GameObject ga = GameObject.FindGameObjectWithTag("Hearth"); spriteRendHearth = ga.GetComponent <SpriteRenderer>(); jc = GetComponent <JumpController>(); }
/// <summary> /// Start function but instead is called after a new scene loads /// </summary> private void InitializeValues() { if (pm == null) { pm = GetComponent <PlayerNewLevelManager>(); } if (!pm.initialized_Move) { wallCheck = transform.Find("Wall Check"); originalWallPos = wallCheck.localPosition.x; pm.initialized_Move = true; rb = GetComponent <Rigidbody2D>(); jumpController = GetComponent <JumpController>(); player = GetComponent <Player>(); } }
public void ProcessInputs(bool grounded, bool jumpButtonPressed, JumpController jumpController) { if (jumpButtonPressed && jumpController.wasJumpButtonReleasedInBetween) { jumpController.anim.SetBool("Jump", true); jumpController.jumpAudio.Play(); jumpController.AddJumpForce(); jumpController.currentJumpState = jumpController.airbornAddingForceState; jumpController.wasJumpButtonReleasedInBetween = false; } else { jumpController.anim.SetBool("Jump", false); } }
public void ProcessInputs(bool grounded, bool jumpButtonPressed, JumpController jumpController) { // The player can quickly get grounded if the ceiling is low for example if (grounded && jumpController.rigidbody.velocity.y <= 0) { SetJumpControllerState(jumpController, jumpController.groundedState); } else if (jumpButtonPressed && forceAddedCount < jumpController.maxForceAddTimes) { forceAddedCount++; jumpController.AddJumpForce(); } else { SetJumpControllerState(jumpController, jumpController.airbornNotAddingForceState); } }
protected virtual void Start() { //MessageKit.addObserver(EventTypes.JUMP_INPUT_DOWN, JumpAnimation); //MessageKit<string[]>.addObserver(EventTypes.ATTACK_INPUT_DOWN_1P, TriggerAttackAnimation); controller = GetComponent <Controller2D>(); movementController = GetComponent <MovementController>(); animator = GetComponent <Animator>(); sprite = GetComponent <SpriteRenderer>(); animationClips = animator.runtimeAnimatorController.animationClips; UpdateAnimationStates(); if (GetComponent <JumpController>() != null) { if (GetComponent <JumpController>().isActiveAndEnabled) { jumpController = GetComponent <JumpController>(); } } }
private void OnEnable() { PlayerMove move = GetComponentInParent <PlayerMove>(); JumpController jump = GetComponentInParent <JumpController>(); WallJump walljump = GetComponentInParent <WallJump>(); _cam._camSize = _camSize; jump._canJump = _canJump; jump._jumpForce = _jumpForce; jump._nGravity = _nGravity; jump._hGravity = _hGravity; move._moveSpeed = _speed; walljump._canDoJump = _wallJump; _collider.size = new Vector2(_sizeX, _sizeY); _collider.edgeRadius = _radious; }
private ExitStepResponse SuccessfulDetermineExitSteps(JumpController controller, string input) { var controllerResult = controller.DetermineExitSteps(input); return(ControllerTestHelper <ExitStepResponse> .Successful(controllerResult)); }
private void FixedUpdate() { HorizontalMovementController?.FixedUpdate(); JumpController?.FixedUpdate(); }
void Start() { rb = GetComponent <Rigidbody>(); jc = GetComponent <JumpController>(); }
private void Start() { myJC = GetComponentInParent <JumpController>(); myMB = GetComponentInParent <MovementBasic>(); }
void Start() { gameManager = GameManagerController.Instance; levelManager = GameObject.FindObjectOfType <LevelManagerController>(); jumpController = GameObject.FindObjectOfType <JumpController>(); }
private void Start() { _body = GetComponent <Rigidbody>(); _jumpControl = GetComponent <JumpController>(); }
// Use this for initialization void Start() { jumper = GameObject.Find("JumpController").GetComponent<JumpController>(); main_camera = GameObject.Find ("CameraController").GetComponent<CameraController> (); cat = GameObject.Find("screemcat"); dog = GameObject.Find("dog"); // sound background music1 SoundManager.instance.PlayBgm (bgm1,true); //================================= posForUI = GameObject.Find ("talking_bubble5").transform.position; if (PlayBeginning) { begin_image = new Sprite[311]; begin_image = Resources.LoadAll<Sprite> ("beginning"); } go_die = new Sprite[191]; go_die = Resources.LoadAll<Sprite> ("dog_die"); Debug.Log (go_die.Length); }
private void Awake() { _jc = GetComponent <JumpController>(); }
void Start() { sensory = gameObject.GetComponent<AnimalSensory>(); moveSpeed = 5f; // The amount of unity units I move each frame moveState = PlatformingState.running; jumpController = gameObject.GetComponent<JumpController>(); }
private int boxCollideCount = 0; // reset in PlayerController void Start() { instance = this; }