private void Start() { movement = GetComponent <Movement>(); climbing = GetComponent <Climbing>(); jump = GetComponent <Jump>(); hide = GetComponent <Hide>(); }
void OnTriggerEnter2D(Collider2D other) { //Debug.Log(other.gameObject.tag); //Debug.Log(other.gameObject); switch (other.gameObject.tag) { case "Log": log = other.gameObject; break; case "Lever": lever = other.gameObject; break; case "Climb": climbingwall = other.gameObject.GetComponent <Climbing>(); climbingwall.objectplayer = this.gameObject; canClimb = true; break; case "Enemy": enemy = other.gameObject; break; } }
// Use this for initialization void Start() { //Standard initialization ropes = new List<Rope>(); thePlayer = this.gameObject; playerClimbing = this.GetComponent<Climbing>(); playerHookController = this.GetComponent<GrapplingHookController>(); }
// Use this for initialization void Start() { climbing = GetComponent<Climbing> (); rigidbody2D = GetComponent<Rigidbody2D> (); if (gameObject.tag == "Player") { PreventCollisionsWithLukes(); } }
private void climbing(int floor) { state = Climbing.getClimbing(); setDy(-CLIMBING); if (getY() > floor) { setY(getY() + getDy()); } }
private void EnterExitOnTrigger(Collider2D collision, float gravityForce, bool isClimbing) { Climbing playerClimbing = collision.GetComponent <Climbing>(); if (playerClimbing != null) { playerClimbing.Rigidbody.gravityScale = gravityForce; playerClimbing.IsClimbing = isClimbing; } }
void OnTriggerEnterExit(Collider2D collision, float gravityForce, bool isClimbing) { Climbing player = collision.GetComponent <Climbing>(); if (player != null) { player.IsClimb = isClimbing; player.Rb.gravityScale = gravityForce; } }
// Use this for initialization void Start() { grapplingHooks = new List<GraplingHook>(); thePlayer = GameObject.Find("Player"); playerClimbing = thePlayer.GetComponent<Climbing>(); playerRopeController = thePlayer.GetComponent<RopeController>(); Name = "GrapplingHook"; Image = Resources.Load<Sprite>("grapplinghook"); IsConsumable = true; Prefab = null; }
private void Awake() { _characterAnimation = GetComponent <CharacterAnimation>(); _mover = GetComponent <Mover>(); _jump = GetComponent <Jump>(); _flip = GetComponent <Flip>(); _onGround = GetComponent <OnGround>(); _climbing = GetComponent <Climbing>(); _health = GetComponent <Health>(); _damage = GetComponent <Damage>(); _audioSource = GetComponent <AudioSource>(); _input = new PcInput(); //instance }
private void CacheProgress() { _spriteRenderer = GetComponentInChildren <SpriteRenderer>(); _jump = GetComponent <Jump>(); _input = new PcInput(); _mover = GetComponent <Mover>(); _characterAnimation = GetComponent <CharacterAnimation>(); _flipPlayer = GetComponent <FlipObj>(); _groundController = GetComponent <GroundController>(); _climbing = GetComponent <Climbing>(); _health = GetComponent <Health>(); _damage = GetComponent <Damage>(); _audioSource = GetComponent <AudioSource>(); }
public void onDeathFinished() { notDead = true; if (checkPoint == null) { this.transform.position = this.startPosition; } else { this.transform.position = checkPoint.transform.position; } if (climbingwall != null) { //Debug.Log("Wall"); climbingwall.killClimbValues(); climbingwall.objectplayer = null; climbingwall = null; //Debug.Log(climbingwall); } }
public void death() { //this if-statement prevents the player being killed while dying :) if (notDead) { deathSound.PlaySound(); animate.SetBool("Climb", false); animate.SetTrigger("Death"); notDead = false; if (climbingwall != null) { //Debug.Log("Wall"); climbingwall.killClimbValues(); climbingwall.objectplayer = null; climbingwall = null; Debug.Log(climbingwall); } climbing = false; rb.gravityScale = 1; } }
private void Start() { rb = GetComponent <Rigidbody2D>(); climbing = GetComponent <Climbing>(); speed = default_speed; }
private void Start() { climbing = transform.parent.GetComponent <Climbing>(); }
/// /////////////////---- UPDATE void Update() { ///movement #region Movement //if (grounded) //{ // if (!previousIsGrounded) // { // movement = new Vector3(0, 0, 0); // } // else // { movement = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); //} //previousIsGrounded = true; playerInput = new Vector3(movement.x, 0, movement.z); playerInput = Vector3.ClampMagnitude(playerInput, 1); //} //else //{ // previousIsGrounded = false; //} #endregion ///CheckingCamera Direction #region Checking Camera Direction CamDirection(); if (grounded) { playerDirection = playerInput.x * camRight + playerInput.z * camForward; previousCamForward = camForward; previousCamRight = camRight; } else { playerDirection = playerInput.x * previousCamRight + playerInput.z * previousCamForward; } transform.LookAt(transform.position + playerDirection); #endregion ///Jump #region Jump if (grounded && Input.GetButtonDown("Jump") && onLadder == false) { Jump(); } #endregion ///Whip #region Whip if (Input.GetMouseButtonDown(0)) { //Destroy(Instantiate(whip, whipHandler.position, transform.rotation), 0.2f); } #endregion //Ladder #region Ladder if (isInside) { if (Input.GetKeyDown(KeyCode.E)) { if (onLadder) { onLadder = false; } else { onLadder = true; } } } else { onLadder = false; } if (onLadder) { if (Input.GetKey(KeyCode.W)) { climbinDirection = Climbing.UP; } else if (Input.GetKey(KeyCode.S)) { climbinDirection = Climbing.DOWN; } else { climbinDirection = Climbing.NONE; } } #endregion //Restarts #region Restart if (Input.GetKeyDown(KeyCode.R)) { SceneManager.LoadScene("MainScene"); } #endregion }
private void Awake() { m_Rigidbody = GetComponent <Rigidbody>(); _colliding = GetComponent <PlayerColliding>(); _climbing = GetComponent <Climbing>(); }
public void ChangeState(playerFSM newPFSM, params object[] items) { if (newPFSM == currentPFSM) { return; } previousPFSM = currentPFSM; currentPFSM = newPFSM; IState newState = null; switch (newPFSM) { case playerFSM.Running: if (running == null) { running = new Running((GameObject)items[0], (float)items[1], (Animator)items[2], (Rigidbody2D)items[3], (int)items[4]); } else { running.PassValues((GameObject)items[0], (float)items[1], (Animator)items[2], (Rigidbody2D)items[3], (int)items[4]); } newState = running; break; case playerFSM.Jumping: if (jumping == null) { jumping = new Jumping((Animator)items[0], (Rigidbody2D)items[1], (float)items[2]); } else { jumping.PassValues((Animator)items[0], (Rigidbody2D)items[1], (float)items[2]); } newState = jumping; break; case playerFSM.Climbing: if (climbing == null) { climbing = new Climbing((Animator)items[0], (Rigidbody2D)items[1], (float)items[2]); } else { climbing.PassValues((Animator)items[0], (Rigidbody2D)items[1], (float)items[2]); } Debug.Log(items[2] + " === "); newState = climbing; break; case playerFSM.Dashing: break; case playerFSM.Sliding: break; case playerFSM.Idle: if (idle == null) { idle = new Idle((Animator)items[0], (Rigidbody2D)items[1]); } else { idle.PassValues((Animator)items[0], (Rigidbody2D)items[1]); } newState = idle; break; } if (currentState != newState) { if (currentState != null) { currentState.Exit(); } previousState = currentState; currentState = newState; currentState.Enter(); } }