void Start() { state = GetComponent <Player_State>(); animator = GetComponent <Player_Animator>(); timers = GetComponent <Player_Timers>(); attributes = state.attributes; speedManager = GetComponent <Speed_Manager>(); leftWallCheck = gameObject.transform.GetChild(2).gameObject.GetComponent <WallCheck>(); rightWallCheck = gameObject.transform.GetChild(3).gameObject.GetComponent <WallCheck>(); velocity = speedManager.velocity; onWall = state.onWall; control = state.control; dashing = state.dashing; dashReady = state.dashReady; dashAttacking = state.dashAttacking; stunned = state.stunned; input = state.input; dashDir = state.dashDir; dash = state.dash; dashCooldownTimer = timers.dashCooldownTimer; dashAttackTimer = timers.dashCooldownTimer; dashTimer = timers.dashTimer; momentumTimer = timers.momentumTimer; moveSpeed = attributes.moveSpeed; dashSpeed = attributes.dashSpeed; dashCooldownTime = attributes.dashCooldownTime; dashTime = attributes.dashTime; dashAttackTime = attributes.dashAttackTime; momentumTime = attributes.momentumTime; collisionMask = attributes.collisionMask; }
void Start() { rb = GetComponent <Rigidbody>(); wallcheck = wallcheckObj.GetComponent <WallCheck>(); animator = donguri.GetComponent <Animator>(); SetSpeed = speed; }
public void WallJump(Animator myAnimator, Rigidbody2D myRigidbody2D, WallCheck[] allWallChecks) { if(!lockWallJump) { foreach(WallCheck localWallCheck in allWallChecks) { if(localWallCheck.walled) { lockWallJump = true; if(myRigidbody2D.transform.localScale.x < 0) { myRigidbody2D.AddForce(new Vector2(myRigidbody2D.velocity.x + jumpForce.x, jumpForce.y)); } else { myRigidbody2D.AddForce(new Vector2(myRigidbody2D.velocity.x - jumpForce.x, jumpForce.y)); } if(!myAnimator.GetCurrentAnimatorStateInfo(0).IsName(jumpAnimationName)) { myAnimator.SetTrigger(jumpAnimationTriggerName); } Invoke ("UnlockWallJump", lockTime); break; } } } }
void Start() { Enemy = gameObject.transform.parent.gameObject; player = GameObject.Find("Player"); groundCheck = player.transform.GetChild(1).gameObject.GetComponent <GroundCheck>(); leftWallCheck = player.transform.GetChild(2).gameObject.GetComponent <WallCheck>(); rightWallCheck = player.transform.GetChild(3).gameObject.GetComponent <WallCheck>(); }
// Start is called before the first frame update void Start() { ren = this.GetComponent <SpriteRenderer>(); ren.enabled = true; attacked = false; groundCheck = player.transform.GetChild(1).gameObject.GetComponent <GroundCheck>(); leftWallCheck = player.transform.GetChild(2).gameObject.GetComponent <WallCheck>(); rightWallCheck = player.transform.GetChild(3).gameObject.GetComponent <WallCheck>(); }
// Use this for initialization void Start() { player = GetComponent <Player>(); Instructions = GameObject.FindGameObjectWithTag("InstructionCanvas"); wallCheck = GetComponent <WallCheck>(); //slopeRayHeight = }
// Start is called before the first frame update void Start() { //Get the Rigid Body playerRB = GetComponent <Rigidbody2D>(); GroundChecker = GameObject.Find("GroundChecker").GetComponent <GroundCheck>(); WallCheck = GameObject.Find("WallDetecor").GetComponent <WallCheck>(); Health = 100; StartCoroutine("InvulTimer"); StartCoroutine("Jump"); }
// Use this for initialization void Start () { idStore = GameObject.Find ("PlayerManager").GetComponent<PlayerIDs> (); GSManager = GameObject.Find("GameState").GetComponent<GameStateManager>(); wallCheck = GetComponentInChildren<WallCheck>(); if (isServer) { GSManager.AddPlayer (this.gameObject); } if (isLocalPlayer) { GSManager.StoreLocalPlayer (this); } }
void Start() { state = GetComponent <Player_State>(); animator = GetComponent <Player_Animator>(); timers = GetComponent <Player_Timers>(); attributes = state.attributes; leftWallCheck = gameObject.transform.GetChild(2).gameObject.GetComponent <WallCheck>(); rightWallCheck = gameObject.transform.GetChild(3).gameObject.GetComponent <WallCheck>(); ReceiveValues(); attackTime = attributes.attackTime; }
private void Start() { groundChecker = GetComponentInChildren <GroundCheck>(); try { speedDisplayObj = FindObjectOfType <SpeedDisplay>(); } catch (NullReferenceException e) { } wallChecker = GetComponentInChildren <WallCheck>(); }
// Start is called before the first frame update void Start() { rb2d = GetComponent <Rigidbody2D>(); gc = GetComponentInChildren <GroundCheck>(); wcs = GetComponentsInChildren <WallCheck>(); left = wcs.OrderBy(x => x.transform.position.x).First(); right = wcs.OrderBy(x => x.transform.position.x).Last(); //Debug.Log(right.transform.position.x); aStrings = GetComponent <ActorMovementManager>().strings; }
void Start() { agent = GetComponent <NavMeshAgent>(); obstacle = GetComponent <NavMeshObstacle>(); animator = donguri.GetComponent <Animator>(); rb = GetComponent <Rigidbody>(); if (wallcheckObj != null) { wallcheck = wallcheckObj.GetComponent <WallCheck>(); } GameObject targetObject = target.gameObject; SetSpeed = Rspeed; }
// Use this for initialization void Start() { idStore = GameObject.Find("PlayerManager").GetComponent <PlayerIDs> (); GSManager = GameObject.Find("GameState").GetComponent <GameStateManager>(); wallCheck = GetComponentInChildren <WallCheck>(); if (isServer) { GSManager.AddPlayer(this.gameObject); } if (isLocalPlayer) { GSManager.StoreLocalPlayer(this); } }
// Start is called before the first frame update void Start() { characterGroundedCheck = GetComponent <CharacterGroundedCheck>(); characterState = GetComponentInParent <CharacterState>(); wallDetectionCollider = transform.parent.GetComponentInChildren <WallDetectionCollider>(); wallDetectionCollider.setTouchingWall += SetIsTouchingWall; wallCheck += WallAheadCheck; characterGroundedCheck.onEnterOverlapCircleDelegate = (collider2D) => { if (characterState.isWallSliding) { characterState.isWallSliding = false; } }; rb2D = GetComponentInParent <Rigidbody2D>(); }
// Start is called before the first frame update void Start() { agent = GetComponent <NavMeshAgent>(); obstacle = GetComponent <NavMeshObstacle>(); animator = donguri.GetComponent <Animator>(); bossanim = donguri.GetComponent <BossBreathEvent>(); particle = BparticleObj.GetComponent <ParticleSystem>(); tparticle = TparticleObj.GetComponent <ParticleSystem>(); rb = GetComponent <Rigidbody>(); wallcheck = wallCheckObj.GetComponent <WallCheck>(); GameObject targetObject = target.gameObject; timecount = 0; particle.Stop(); tparticle.Stop(); TSetSpeed = Tspeed; //サウンド Breath = GetComponent <CriAtomSource>(); stopBreath = true; Tackle = TackleSound.GetComponent <CriAtomSource>(); }
// Use this for initialization void Start() { //finder scriptet GroundCheck, så det kan undersøges om figuren er grounded groundCheck = gameObject.GetComponentInChildren <GroundCheck>(); wallCheck = gameObject.GetComponentInChildren <WallCheck>(); remainingJumps = JumpCount; if (GameManager.instance.DebugMode) { if (!this.CheckForComponent <Rigidbody2D>()) { Debug.LogWarning("RigidBody Missing from Jump"); } if (JumpPower < 1f || JumpCount < 1) { Debug.LogWarning("JumpPower or JumpCount too low"); } } }
// Use this for initialization void Start() { shop = GetComponent <PlayerShop> (); playerBody = GetComponent <Rigidbody2D> (); networkInfo = GetComponent <NetSetup> (); carryControl = GetComponent <CarryControl> (); anim = GetComponent <Animator> (); gravityInitial = playerBody.gravityScale; wallCheck = GetComponentInChildren <WallCheck> (); baitManager = GetComponent <BaitManager> (); string[] controllers = Input.GetJoystickNames(); foreach (string s in controllers) { Debug.Log(s); } if (controllers.Length > 0) { controllerEnabled = true; } input = new GeneralInput(); input.controllerEnabled = controllerEnabled; // // superJumpModeText = GameObject.Find ("PowerJumpMode").GetComponent<Text> (); }
void Start() { rb = GetComponent <Rigidbody>(); wallcheck = GameObject.Find("WallCheck").GetComponent <WallCheck>(); SetSpeed = speed; }
void Start() { check = GetComponent <WallCheck>(); helper = new GameObject(); helper.name = "HelperObject"; }
// Use this for initialization void Start () { shop = GetComponent<PlayerShop> (); playerBody = GetComponent<Rigidbody2D> (); networkInfo = GetComponent<NetSetup> (); carryControl = GetComponent<CarryControl> (); anim = GetComponent<Animator> (); gravityInitial = playerBody.gravityScale; wallCheck = GetComponentInChildren<WallCheck> (); baitManager = GetComponent<BaitManager> (); string[] controllers = Input.GetJoystickNames (); foreach (string s in controllers) { Debug.Log (s); } if (controllers.Length > 0) { controllerEnabled = true; } input = new GeneralInput (); input.controllerEnabled = controllerEnabled; // // superJumpModeText = GameObject.Find ("PowerJumpMode").GetComponent<Text> (); }
void Update() { /*if(loadingShot){ * Invoke("ChangeColor",0.2f); * if(shotSound==false &&shotCount>=0.3f){ * sons[1].Play(); * shotSound=true; * } * else{ * if(shotSound2==false && !sons[1].isPlaying &&shotCount>=0.3f){ * sons[2].Play(); * shotSound2=true; * } * } * } * else if(cor){ * personagem.material.color = new Color(1f,1f,1f,1f); * cor=false; * }*/ ///STAND if (currentState == (int)State.Stand && canMove) { side = Input.GetAxisRaw("Horizontal"); stateTimer++; if (Input.GetAxisRaw("Horizontal") == -1f || Input.GetAxisRaw("Horizontal") == 1f) { side = Input.GetAxisRaw("Horizontal"); currentState = (int)State.Move; stateTimer = 0; } if (Input.GetKeyDown(KeyCode.X)) { currentState = (int)State.Jump; stateTimer = 0; } if (Input.GetKeyDown(KeyCode.Z)) { currentState = (int)State.StandShoot; sons[0].Play(); Instantiate(tiro, new Vector3(transform.localPosition.x, transform.localPosition.y, transform.localPosition.z), Quaternion.identity); stateTimer = 0; } if (Input.GetKey(KeyCode.Z)) { shotCount += Time.deltaTime; loadingShot = true; Invoke("ChangeColor", 0.2f); if (shotSound == false && shotCount >= 0.3f) { sons[1].Play(); shotSound = true; } else { if (shotSound2 == false && !sons[1].isPlaying && shotCount >= 0.3f) { sons[2].Play(); shotSound2 = true; } } } else if (Input.GetKeyUp(KeyCode.Z)) { currentState = (int)State.StandShoot; sons[2].Stop(); sons[0].Play(); loadingShot = false; cor = false; colorCount = 0; Invoke("ChangeColor", 0.01f); shotSound = false; shotSound2 = false; if (shotCount > 0) { Instantiate(tiro2, new Vector3(transform.localPosition.x, transform.localPosition.y, transform.localPosition.z), Quaternion.identity); shotCount = 0; } } if (!VerificaChao.checkGround(transform.position)) { currentState = (int)State.Fall; stateTimer = 0; } if (dashing) { currentState = (int)State.Dash; stateTimer = 0; } } ///MOVE else if (currentState == (int)State.Move && canMove) { stateTimer++; side = Input.GetAxisRaw("Horizontal"); if (Input.GetAxisRaw("Horizontal") == 0f) { currentState = (int)State.Stand; stateTimer = 0; } if (Input.GetKeyDown(KeyCode.X)) { currentState = (int)State.Jump; stateTimer = 0; } if (Input.GetKeyDown(KeyCode.Z)) { Instantiate(tiro, new Vector3(transform.localPosition.x, transform.localPosition.y, transform.localPosition.z), Quaternion.identity); sons[0].Play(); currentState = (int)State.MoveShoot; stateTimer = 0; } if (dashing) { currentState = (int)State.Dash; stateTimer = 0; } if (!VerificaChao.checkGround(transform.position)) { currentState = (int)State.Fall; stateTimer = 0; } } ///JUMP else if (currentState == (int)State.Jump && canMove) { stateTimer++; side = Input.GetAxisRaw("Horizontal"); if (VerificaChao.checkGround(transform.position)) { currentState = (int)State.Stand; stateTimer = 0; } if (dashing) { currentState = (int)State.Dash; stateTimer = 0; } if (Input.GetKeyDown(KeyCode.Z)) { currentState = (int)State.JumpShoot; stateTimer = 0; } if ((WallCheck.leftWall(transform.position) && Input.GetKey(KeyCode.LeftArrow)) || (WallCheck.rightWall(transform.position) && Input.GetKey(KeyCode.RightArrow))) { currentState = (int)State.WallSliding; } } ///FALL else if (currentState == (int)State.Fall && canMove) { stateTimer++; side = Input.GetAxisRaw("Horizontal"); if (VerificaChao.checkGround(transform.position)) { currentState = (int)State.Stand; stateTimer = 0; } if (dashing) { currentState = (int)State.Dash; stateTimer = 0; } if (Input.GetKeyDown(KeyCode.Z)) { currentState = (int)State.JumpShoot; stateTimer = 0; } if ((WallCheck.leftWall(transform.position) && Input.GetKey(KeyCode.LeftArrow)) || (WallCheck.rightWall(transform.position) && Input.GetKey(KeyCode.RightArrow))) { currentState = (int)State.WallSliding; } } ///DASH else if (currentState == (int)State.Dash && canMove) { dashing = false; stateTimer++; if (stateTimer > 20) { currentState = (int)State.Stand; stateTimer = 0; } } ///STAND-SHOOT else if (currentState == (int)State.StandShoot && canMove) { stateTimer++; if (stateTimer > 20) { currentState = (int)State.Stand; stateTimer = 0; } } ///JUMP-SHOOT else if (currentState == (int)State.JumpShoot && canMove) { side = Input.GetAxisRaw("Horizontal"); stateTimer++; if (stateTimer > 20) { currentState = (int)State.Fall; stateTimer = 0; } if (VerificaChao.checkGround(transform.position)) { currentState = (int)State.Stand; stateTimer = 0; } } ///MOVE-SHOOT else if (currentState == (int)State.MoveShoot && canMove) { side = Input.GetAxisRaw("Horizontal"); stateTimer++; if (stateTimer > 20) { currentState = (int)State.Move; stateTimer = 0; } if (!VerificaChao.checkGround(transform.position)) { currentState = (int)State.Fall; stateTimer = 0; } } ///WALL-SLIDING else if (currentState == (int)State.WallSliding && canMove) { stateTimer++; if (Input.GetKeyDown(KeyCode.X)) { if (WallCheck.leftWall(transform.position)) { rb2d.AddForce(new Vector2(600f, 100f)); } else if (WallCheck.rightWall(transform.position)) { rb2d.AddForce(new Vector2(-600f, 100f)); } currentState = (int)State.Jump; stateTimer = 0; } if (WallCheck.leftWall(transform.position) && Input.GetKeyUp(KeyCode.LeftArrow)) { currentState = (int)State.Fall; stateTimer = 0; } if (WallCheck.rightWall(transform.position) && Input.GetKeyUp(KeyCode.RightArrow)) { currentState = (int)State.Fall; stateTimer = 0; } if (VerificaChao.checkGround(transform.position)) { currentState = (int)State.Stand; stateTimer = 0; } if (!WallCheck.rightWall(transform.position) && !WallCheck.leftWall(transform.position)) { currentState = (int)State.Fall; stateTimer = 0; } } if ((Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.LeftArrow)) && dashTimer <= 0) { dashTimer = 40; dashSide = Input.GetAxisRaw("Horizontal"); } if (dashTimer > 0) { dashTimer--; if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.LeftArrow)) { if (Input.GetAxisRaw("Horizontal") == dashSide && dashTimer <= 35) { dashing = true; } } } else { dashSide = 0f; } if (stateTimer == 0) { startingState = true; } else { startingState = false; } anim.SetInteger("state", currentState); if (side != 0f) { transform.localScale = new Vector2(4f * side, transform.localScale.y); } //DEATH else if (currentState == (int)State.Death) { } }