void Start() { theEnemyCharacterMotor = gameObject.GetComponent<CharacterMotor2> (); thePlayerCharacterMotor = GameObject.Find ("Player").GetComponent<CharacterMotor2> (); //Using "ThePlayerCharacterMotor" to find this to avoid having to search through everything again. thePlayerGrounded = thePlayerCharacterMotor.GetComponentInChildren<GroundCheck> (); }
// Use this for initialization void Start () { _particleSystem = GetComponentInChildren<ParticleSystem>(); _particleSystem.playbackSpeed = 4; _particleSystem.gameObject.SetActive(false); _rigidbody = GetComponent<Rigidbody>(); _animator = GetComponentInChildren<Animator>(); _groundCheck = GetComponentInChildren<GroundCheck>(); }
public void Jump(Animator myAnimator, Rigidbody2D myRigidbody2D, GroundCheck groundCheck) { if(groundCheck.grounded && !lockJump) { lockJump = true; if(!myAnimator.GetCurrentAnimatorStateInfo(0).IsName(jumpAnimationName)) { myAnimator.SetTrigger(jumpAnimationTriggerName); myRigidbody2D.AddForce(jumpForce); } Invoke("UnlockJump", lockTime); } }
void Start() { RB = GetComponent <Rigidbody>(); //Agent = GetComponent<NavMeshAgent>(); Grounded = GetComponent <GroundCheck>(); Path = new NavMeshPath(); // Agent.updatePosition = false; // Agent.updateRotation = false; // Agent.updateUpAxis = false; NavTarget = Player.transform; }
protected void Start() { actor = gameObject; actorTf = actor.transform; actorRb = actor.GetComponent<Rigidbody2D>(); effects = GetComponent<ActorEffects>(); hand = getChildGameObject(gameObject, "Hand"); groundCheck = new GroundCheck((getChildGameObject(gameObject, "GroundCheck")).transform, LayerMask.GetMask("Ground"), effects, shakeCamera); animations = new ActorAnimations(GetComponent<Animator>()); move = new Move(actor, actorRb, groundCheck, animations); weapon = new Weapon(actor, LayerMask.GetMask("Sword"), hand, startWithWeapon); jump = new Jump(actor, actorRb, groundCheck, animations, effects, hand, weapon); }
// Use this for initialization void Start() { PlayerState = State.OnGround; jump = GetComponent <Jump>(); pms = GetComponent <PlayerMovementSmooth>(); climb = GetComponent <Climb>(); lame = GetComponent <LadderMovement>(); whip = GetComponentInChildren <Whip>(); gc = GetComponentInChildren <GroundCheck>(); playerCollider = GetComponent <BoxCollider2D>(); }
private float facing; // -1 : left , 1 : right // Start is called before the first frame update void Start() { isGrounded = true; isDashing = false; state = State.GROUND; facing = 1; player = GetComponent <Transform>(); rend = GetComponent <SpriteRenderer>(); party = "player"; leftCollider = GetComponentInChildren <LeftSideCollider>(); rightCollider = GetComponentInChildren <RightSideCollider>(); groundCheck = GetComponentInChildren <GroundCheck>(); headCheck = GetComponentInChildren <HeadCheck>(); }
void Reset() { // Get head ( ͡° ͜ʖ ͡°) head = GetComponentInChildren <Camera>().transform; // Get the capsule collider capsuleCollider = GetComponentInChildren <CapsuleCollider>(); // Get or create the groundCheck object. groundCheck = GetComponentInChildren <GroundCheck>(); if (!groundCheck) { groundCheck = GroundCheck.Create(transform); } }
void Start() { state = GetComponent <Player_State>(); animator = GetComponent <Player_Animator>(); timers = GetComponent <Player_Timers>(); attributes = state.attributes; groundCheck = gameObject.transform.GetChild(1).gameObject.GetComponent <GroundCheck>(); ReceiveValues(); moveSpeed = attributes.moveSpeed; jumpVelocity = attributes.jumpVelocity; diveSpeed = attributes.diveSpeed; landingTime = attributes.landingTime; diveAttackTime = attributes.diveAttackTime; diveCollisionMask = attributes.diveCollisionMask; }
public Jump(GameObject actor, Rigidbody2D actorRb, GroundCheck groundCheck, ActorAnimations animations, ActorEffects effects, GameObject hand, Weapon weapon) { this.actor = actor; this.actorTf = actor.transform; this.actorRb = actorRb; this.groundCheck = groundCheck; this.animations = animations; this.effects = effects; this.hand = hand; this.weapon = weapon; timeBtwJump = startTimeBtwJump; timeBtwWallJump = startTimeBtwWallJump; timeBtwJumpTrail = startTimeBtwJumpTrail; }
// Start is called before the first frame update void Start() { GroundCheck groundCheck = GetComponent <GroundCheck>(); Animator anim = GetComponent <Animator>(); anim.SetBool("Ground", groundCheck.OnGround); groundCheck.GroundOut += () => anim.SetBool("Ground", groundCheck.OnGround); groundCheck.GroundIn += () => anim.SetBool("Ground", groundCheck.OnGround); Rigidbody2D rb = GetComponent <Rigidbody2D>(); GetComponent <Damageable>().damageAction += (n) => { rb.AddForce(15 * Mathf.Sign(n.transform.lossyScale.x) * Vector2.right, ForceMode2D.Impulse); }; }
private Transform tm; // Shorthand reference for "transform" - I do this to reduce typing. /** Grab references to all of the components we'll be contacting, such as animator and transform. * This function is called before the game starts; without doing this, we'll get a lot of errors and * won't be able to move, animate, or get our player working. */ private void Awake() { if (instance == null) // Set up the Singleton Design pattern. { instance = this; } anim = GetComponent <Animator>(); audi = GetComponent <AudioSource>(); rb = GetComponent <Rigidbody2D>(); sr = GetComponent <SpriteRenderer>(); tm = GetComponent <Transform>(); groundCheck = Transform.FindObjectOfType <GroundCheck>(); groundCheck.anim = this.anim; interactBox.SetActive(false); // Deactivate the interaction hitbox. }
private void Start() { scooter_rb = scooter.GetComponent <Rigidbody>(); rag = GetComponentInChildren <Ragdoll>(); movement = GetComponent <Movement>(); movement_M = GetComponent <Movement_Mobile>(); groundCheck = GetComponentInChildren <GroundCheck>(); stateManager = GetComponent <PlayerStateManager>(); forwardMovement = GetComponent <ForwardMovement>(); horizontalMovement = GetComponent <HorizontalMovement>(); horizontalMovementMobile = GetComponent <HorizontalMovement_Mobile>(); jump = GetComponent <Jump>(); jumpMobile = GetComponent <Jump_Mobile>(); gameOver = gameOverObject.GetComponent <GameOver>(); }
// Start is called before the first frame update void Start() { rb2D = gameObject.GetComponent <Rigidbody2D>(); gCheck = gameObject.GetComponentInChildren <GroundCheck>(); pSprite = gameObject.GetComponentInChildren <PlayerSprite>(); filaMovimentos = new Queue <TipoMove>(qtdMov); for (int i = 0; i < qtdMov; i++) { filaMovimentos.Enqueue(FilaRand()); } hudSetas.SetTamanhoPainel(qtdMov); hudSetas.RefreshPainel(GetFilaMovs()); //InvokeRepeating("FilaCycle", cooldown, cooldown); }
void Start() { groundCheck = GetComponentInChildren <GroundCheck>(); rb2d = GetComponent <Rigidbody2D>(); if (GameManager.instance.DebugMode) { if (!X && !Y) { Debug.LogWarning("Neither X or Y enabled, enable one or both."); } if (!this.CheckForComponent <Rigidbody2D>()) { Debug.LogWarning("Rigidbody Not Found On Player"); } } }
private void Start() { _gc = GetComponent <GroundCheck>(); _kc = FindObjectOfType <KillCounter>(); _grounded = true; _inCombat = false; _freezeMovement = false; _attackTimer = 0f; _baseScale = _parent.localScale.x; _attackCooldown = Random.Range(_attackCooldownMM.x, _attackCooldownMM.y); _layerMask = ~(LayerMask.GetMask("Enemies")); Vector3 startPos = _obstacleCheckOffset; startPos.x *= Mathf.Sign(_parent.localScale.x); _playerCheck = Physics2D.Raycast(transform.position + startPos, Vector2.left * Mathf.Sign(_parent.localScale.x), _combatRange); _patrolling = StartCoroutine(Patrol()); }
private void Start() { GroundCheck = GetComponent <GroundCheck>(); PlayerThrust = GetComponent <PlayerThrust>(); PlayerTurn = GetComponent <PlayerTurn>(); PlayerCarve = GetComponent <PlayerCarve>(); PlayerFriction = GetComponent <PlayerGroundFriction>(); PlayerDash = GetComponent <PlayerDash>(); PlayerBoost = GetComponent <PlayerBoost>(); PlayerJump = GetComponent <PlayerJump>(); PlayerAirControl = GetComponent <PlayerAirControl>(); QuadraticDrag = GetComponent <QuadraticDrag>(); CenterOfMass = GetComponent <CustomCenterOfMass>(); RB = GetComponent <Rigidbody>(); Combat = GetComponent <CombatController>(); CanCarve = true; }
//TODO FALLING THROUGH PLATFORMS void Start() { m_inputHandler = GetComponent <InputHandler>(); m_physicsController = GetComponent <PhysicsController>(); m_groundCheck = GetComponent <GroundCheck>(); m_actorReference = GetComponent <Actor>(); m_isJumping = true; groundCheck = true; m_capAcceleration = true; if (transform.localRotation.y == 0.0f) { m_facingRight = true; } else { m_facingRight = false; } }
void Start() { rb = GetComponent <Rigidbody2D>(); sr = GetComponent <SpriteRenderer>(); groundCheck = GetComponentInChildren <GroundCheck>(); grabCheck = GetComponentInChildren <GrabCheck>(); animator = GetComponent <Animator>(); Assert.IsNotNull(groundCheck); Assert.IsNotNull(rb); Assert.IsNotNull(sr); //rb.constraints = RigidbodyConstraints2D.FreezeRotation; #if UNITY_EDITOR mousePressedPosition = new Vector2[1]; #elif (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8) mousePressedPosition = new Vector2[5]; #endif }
void Start() { rb = gameObject.GetComponent <Rigidbody>(); navAgent = gameObject.GetComponent <NavMeshAgent>(); controller = gameObject.GetComponent <CharacterController>(); groundChecker = gameObject.GetComponentInChildren <GroundCheck>(); lookAtVector = Vector3.forward; actionQueue = new Queue <Command>(); groundIK = GetComponentInChildren <GrounderFBBIK>(); groundIK.enabled = false; lookIK.enabled = false; ikMod.enabled = false; }
private void ResetContinue() { PlayerHealth playerHealth = player.GetComponent <PlayerHealth>(); GroundCheck platform = player.GetComponent <GroundCheck>(); MyUIManager uiManager = GameObject.Find("Canvas").GetComponent <MyUIManager>(); playerHealth.ResetHealth(player.GetComponent <PlayerData>()); uiManager.ResetHealthUpdate(); player.transform.position = new Vector3(platform.lastPlatform.transform.position.x, platform.lastPlatform.transform.position.y + 4f, platform.lastPlatform.transform.position.z); //Debug.Log(platform.lastPlatform.transform.position); GameOver gameOver = GameObject.Find("Canvas").GetComponent <GameOver>(); gameOver.ContinueGame(); Debug.Log(gameObject.name); gameObject.SetActive(false); }
public override void Process() { base.Process(); if (Slide.Active) { Slide.Process(); } else { Speed.Calculate(Control.AbsoluteScale, speedModifiers); Direction.Calculate(); } Jump.Process(); GroundCheck.Do(); velocity = Direction.Forward * Speed.Value.y + Direction.Right * Speed.Value.x; velocity = Vector3.ProjectOnPlane(velocity, GroundCheck.Resault.hit.normal); }
// Sets the player components needed by the controller on initialisation void Start() { rigid = GetComponent <Rigidbody2D>(); GameObject healthGameObject; if (this.playerNumber == 1) { healthGameObject = GameObject.FindWithTag("P1HealthText"); } else { healthGameObject = GameObject.FindWithTag("P2HealthText"); } healthText = healthGameObject.GetComponent <Text>(); GroundCheck groundCheck = GetComponentInChildren <GroundCheck>(); groundCheck.setPlayer(this); animator = GetComponent <Animator>(); playerSprite = this.gameObject.GetComponent <SpriteRenderer>(); gameManager = FindObjectOfType <GameManager>(); }
void Start() { unlocks = GetComponentInParent <PlayerUnlocks>(); rb2d = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); groundCheck = GetComponent <GroundCheck>(); this.facingRight = false; currentHP = unlocks.maxHP; currentEnergy = unlocks.maxEnergy; maxEnergy = 5; cyanMaterial = Resources.Load <Material>("Shaders/CyanFlash"); spr = GetComponent <SpriteRenderer>(); defaultMaterial = GetComponent <SpriteRenderer>().material; gunEyes = transform.Find("GunEyes").transform; gun = GetComponentInChildren <Gun>(); interaction = GetComponentInChildren <InteractAppendage>(); Flip(); ResetAirJumps(); lastSafeOffset = this.transform.position; speedLimiter = GetComponent <SpeedLimiter>(); spriteRenderers = new List <SpriteRenderer>(GetComponentsInChildren <SpriteRenderer>(includeInactive: true)); }
// 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"); } } }
// Start is called before the first frame update void Start() { //Health canTakeDamage = true; currentHP = maxHP; //Movement cameraGO = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraControls>(); groundCheck = GameObject.Find("GroundCheck").GetComponent <GroundCheck>(); //Animation //anim = GameObject.Find("aj@Idle").GetComponent<Animator>(); //Audio audioSource = this.GetComponent <AudioSource>(); playOnce = true; isAlive = true; //UI imageTeleport = GameObject.Find("teleportUI").GetComponent <Image>(); //getting image imageDeath = GameObject.Find("deathUI").GetComponent <Image>(); teleportFade = imageTeleport.color; //getting color from image deathFade = imageDeath.color; teleportFadeFloat = 1f; //creating alpha channel (0-1) deathFadeFloat = 0f; teleportFade.a = teleportFadeFloat; //setting alpha channel for the color deathFade.a = deathFadeFloat; imageTeleport.color = teleportFade; //setting color to image imageDeath.color = deathFade; teleportFadeBool = false; //setting bool to change alpha for teleport image //Cursor.lockState = CursorLockMode.Locked; }
void Start() { unlocks = GetComponentInParent <SaveWrapper>().save.unlocks; rb2d = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); groundCheck = GetComponent <GroundCheck>(); options = GlobalController.save.options; this.facingRight = false; cyanMaterial = Resources.Load <Material>("Shaders/CyanFlash"); spr = GetComponent <SpriteRenderer>(); defaultMaterial = GetComponent <SpriteRenderer>().material; gunEyes = transform.Find("GunEyes").transform; gun = GetComponentInChildren <Gun>(); interaction = GetComponentInChildren <InteractAppendage>(); lastSafeOffset = this.transform.position; speedLimiter = GetComponent <SpeedLimiter>(); spriteRenderers = new List <SpriteRenderer>(GetComponentsInChildren <SpriteRenderer>(includeInactive: true)); combatActives = GetComponentsInChildren <ActiveInCombat>(includeInactive: true); diamondShine = Resources.Load("Effects/DiamondShine") as GameObject; airAttackTracker = GetComponent <AirAttackTracker>(); RefreshAirMovement(); deathEvent = Resources.Load("ScriptableObjects/Events/Player Death") as GameEvent; }
// Start is called before the first frame update void Start() { attackCommand = GetComponent <PlayerAttack>(); rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); groundCheck = GetComponent <GroundCheck>(); //jumpCommand = new JumpCommand(rb, jumpHeight); jumpCommand = GetComponent <JumpCommand>(); //lampCommand = GetComponent<LampCommand>(); //используем Input.GetAxis для оси Х. метод возвращает значение оси в пределах от -1 до 1. //при стандартных настройках проекта //-1 возвращается при нажатии на клавиатуре стрелки влево (или клавиши А), //1 возвращается при нажатии на клавиатуре стрелки вправо (или клавиши D) motion = GetComponent <MoveXCommand>(); lampCommand = GetComponent <LampCommand>(); //lampButtonIsPressed = () => Input.GetKeyDown(lampButton); lampButtonIsPressed = () => false; PickUpEvent.Action += (s) => { switch (s) { case "lamp": lampButtonIsPressed = () => Input.GetKeyDown(lampButton); break; } }; transform.GetComponent <PlayerAttack>().attacker.AttackTrigger = () => Input.GetKeyUp(KeyCode.Z); }
void Awake() { animator = GetComponent<Animator>(); groundCheck = GetComponentInChildren<GroundCheck>(); }
private void Awake() { groundCheck = GetComponent <GroundCheck> (); moveFunc = GetComponent <moveFunctions> (); }
private void Awake() { m_Rigidbody = GetComponent <Rigidbody>(); m_GroundCheck = GetComponent <GroundCheck>(); }
// Use this for initialization void Start() { children = gameObject.GetComponentInChildren<GroundCheck>(); children.JumpCount = JumpAmount; rg2d = gameObject.GetComponent<Rigidbody2D>(); }
void Reset() { // Try to get groundCheck. groundCheck = GetComponentInChildren <GroundCheck>(); }
// Use this for initialization void Start() { // Get needed Objects levelHandler = GameObject.FindGameObjectWithTag("GameController").GetComponent<LevelBlockHandler>(); grounded = GameObject.FindGameObjectWithTag("GroundChk").GetComponent<GroundCheck>(); }
void Start() { myGround = GetComponent<GroundCheck> (); }
void Awake() { this.resetting = false; // Set our activate cooldown this.activateTimer = 0; // Find our game controller this.gameController = FindObjectOfType<GameControllerScript>(); int levelCompletionTime = FindObjectOfType<LevelStats>().levelCompletionTime; // Allocate enough space in the array for recorded input this.recordedInput = new CapturedInput[levelCompletionTime]; this.groundCheck = GetComponent<GroundCheck>(); this.playerColor = GetComponent<SpriteRenderer>().color; this.originalPosition = transform.position; this.currentInput = new CapturedInput(); this.activatorsList = new Hashtable(); this.overwriteLoop = false; }
// Use this for initialization void Start() { theGroundCheck = GetComponentInChildren<GroundCheck> (); theCharacterMotor = GetComponent<CharacterMotor2> (); }
private void Awake() { playerRigidbody = GetComponent <Rigidbody2D>(); groundChecker = GetComponent <GroundCheck>(); }
void Awake() { groundcheck = GameObject.FindObjectOfType(typeof(GroundCheck)) as GroundCheck; // anim = GetComponent<Animator>(); }
void Start() { rope = GetComponentInChildren <Rope>(); feet = GetComponentInChildren <GroundCheck>(); }
void Start() { rigidbody = GetComponent<Rigidbody2D>(); groundCheck = GetComponentInChildren<GroundCheck>(); animator = GetComponentInChildren<Animator>(); }