// Start is called before the first frame update void Start() { Tilemap[] Tilemaps; Tilemaps = GameObject.FindObjectsOfType <Tilemap>(); for (int i = 0; i < Tilemaps.Length; i++) { if (Tilemaps[i].tag == "tilemap") { tilemap = Tilemaps[i]; break; } } load = tilemap.GetComponent <Load>(); pathfinding = tilemap.GetComponent <pathfinding>(); Player = GameObject.FindGameObjectWithTag("Player").transform; Tilemap[] tilemaps; tilemaps = GameObject.FindObjectsOfType <Tilemap>(); for (int i = 0; i < tilemaps.Length; i++) { if (tilemaps[i].tag == "HighLight") { HighLight = tilemaps[i]; break; } } EnemyMapPosition = tilemap.WorldToCell(transform.position); transform.position = tilemap.CellToWorld(EnemyMapPosition); playerMovement = GameObject.FindGameObjectWithTag("Player").GetComponent <playerMovement>(); nextTurn = GameObject.FindGameObjectWithTag("Canvas").GetComponent <NextTurn>(); }
void Start() { player = GameObject.FindWithTag("Player"); pauseThings = GameObject.FindGameObjectsWithTag("pauseMenu"); // enemies = GameObject.FindGameObjectsWithTag("enemy"); playerMovement = player.GetComponent <playerMovement>(); }
// Use this for initialization void Start() { playerMov = transform.GetComponentInParent <playerMovement> (); playerRB = transform.GetComponentInParent <Rigidbody> (); jumpForce = 1700; downForce = 1000; }
// Start is called before the first frame update void Start() { playerMovement = GameObject.FindGameObjectWithTag("Player").GetComponent <playerMovement>(); NextTurnButton = transform.GetComponentInChildren <Button>(); Panel = GameObject.FindGameObjectWithTag("EventPanel").GetComponent <Image>(); Panel.gameObject.SetActive(false); }
private void Start() { playMove = FindObjectOfType <playerMovement>(); damage = playMove.rangedDamage; lifetimeTime = lifeTime; fire = FindObjectOfType <Fire>(); }
// Update is called once per frame void Update() { if (movement == null) { movement = GameObject.FindGameObjectWithTag("VRPlayer").GetComponent <playerMovement>(); } if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = gameObject.GetComponentInChildren <Camera>().ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 100.0f)) { //Debug.Log(hit.point); if (hit.transform != null) { CmdgiveTarget(hit.point); } } } float vertical = Input.GetAxis("Vertical") * 10 * Time.deltaTime; float horizontal = Input.GetAxis("Horizontal") * 10 * Time.deltaTime; transform.Translate(horizontal, 0, vertical); { } }
public void Start() { goalsMade = 0; movement = this.GetComponent <playerMovement>(); movement.playerId = playerId; coloredPlayerText = "<color=#" + ColorUtility.ToHtmlStringRGB(playerColor) + ">" + playerName + "</color>"; }
// Start is called before the first frame update void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); SC = GameObject.FindObjectOfType <SliderScript>(); PM = GameObject.FindObjectOfType <playerMovement>(); Instantiate(BossBullet, bulletPoint.position, Quaternion.identity); }
private void Start() { Invoke("LeaveProjectile", lifeTime); playMove = FindObjectOfType <playerMovement>(); damage = playMove.rangedDamage; lifetimeTime = lifeTime; }
// Use this for initialization void Start() { anim = GetComponent <Animator> (); // Reference to the player's animator component. playerhealth = GetComponent <Health>(); playermovement = GetComponent <playerMovement> (); }
private void Update() { playerMovement movement = (GetComponent <playerMovement>() as playerMovement); if (word == keywords[0]) { movement.GoLeft(); } else if (word == keywords[1]) { movement.GoRight(); } else if (word == keywords[2]) { movement.GoUp(); } else if (word == keywords[3]) { movement.GoDown(); } else if (word == keywords[4]) { movement.Stop(); } else if (word == keywords[5]) { movement.Revert(); } }
private void OnCollisionEnter2D(Collision2D collision) { Scene wherearewe = SceneManager.GetActiveScene(); if (collision.gameObject.tag == "Player") { playerMovement tobechecked = collision.gameObject.GetComponent <playerMovement>(); if (tobechecked.isDashing) { coinCount--; coinCountText.text = "Boxes: " + coinCount; spriteRenderer.enabled = false; boxCollider2D.enabled = false; if (coinCount <= 0) { if (wherearewe.name == "demoscene") { coinCount = 8; SceneManager.LoadScene(1); } else if (wherearewe.name == "lvtwo") { coinCount = 10; SceneManager.LoadScene(2); } else if (wherearewe.name == "lvthree") { coinCountText.text = "VICTORY: \nPress Escape!!"; hasWon = true; } } } } }
void Start() { respawnpositions = new List <float>(); respawns = GameObject.FindGameObjectsWithTag("respawn"); m_health = player.GetComponent <PlayerHealth>(); playerMovement = player.GetComponent <playerMovement>(); cameraFollow = cameraObject.GetComponent <CameraFollow>(); soundManager = GameObject.Find("SoundManager"); /* foreach(GameObject respawn in respawns) * { * respawnpositions.Add(respawn.transform.position.x); * * for(int i = 0; i<respawns.Length;i++) * { * if(respawn.transform.position.x<reverse[i].transform.position.x) * { * * } * } * }*/ reverse = Enumerable.Reverse(respawns).ToArray(); for (int i = 0; i < respawnpositions.Count; i++) { Debug.Log(respawns[i]); } ClosestSpawn = 0; }
// Start is called before the first frame update void Start() { audioSource = GetComponent <AudioSource>(); //make singleton if (instance != null) { Destroy(this); } else { instance = this; } //save spriterenderer sprite = GetComponent <SpriteRenderer>(); //PlayerStats.player_tr = transform.position; if (PlayerStats.player_tr.x != 0 && PlayerStats.player_tr.y != 0 && PlayerStats.player_tr.y != 0) { transform.position = PlayerStats.player_tr; Debug.Log(transform.position); } }
// Use this for initialization void Start() { //make sure this array is empty collidedObjects.Clear(); thisPosition = this.transform.position; //we have to grab the renderer components from the game objects we're using to see the bounds of the layers maxRend = maximumSphere.GetComponent <Renderer>(); lay3Rend = layer3Sphere.GetComponent <Renderer>(); lay2Rend = layer2Sphere.GetComponent <Renderer>(); minRend = minimumSphere.GetComponent <Renderer>(); //we turn off the collider rendering during gameplay if we're not debugging if (!debug) { maxRend.enabled = false; lay3Rend.enabled = false; lay2Rend.enabled = false; minRend.enabled = false; } else //if debug is active, we want to turn them on { maxRend.enabled = true; lay3Rend.enabled = true; lay2Rend.enabled = true; minRend.enabled = true; } pmScript = (playerMovement)GameObject.FindWithTag("Player").transform.GetChild(0).gameObject.GetComponent(typeof(playerMovement)); //set the ray to start at our position ray.origin = this.transform.position; //set it's direction ray.direction = this.transform.forward; }
public LayerMask powerMask; //stops the wind power from blocking light void Start() { lights = new List <GameObject>(); movementScript = GetComponent <playerMovement>(); finalMask = wallMask | groundMask | ceilingMask; //sets the layer mask to be equal to all of the layers InvokeRepeating("checkIsInLight", 0f, 0.25f); //will check every quarter second instead of every frame to improve performance }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); playerMovement = gameObject.GetComponent <playerMovement>(); playerScore = gameObject.GetComponent <PlayerScore>(); dodgeRender = gameObject.GetComponent <PlayerDodgeRender>(); }
private void Start() { this.isBoy = GameManager.instance.gender; this.isBoy.genderOnChange += onGenderChange; PlayerMovement = GetComponent <playerMovement>(); genderChecker(); }
/// <summary> /// Called with trigger /// </summary> /// <param name="other"></param> private void OnTriggerStay2D(Collider2D other) { playerMovement player = other.GetComponent <playerMovement>(); if (player != null && room.getIsOpen()) { if (Input.GetKeyDown(KeyCode.Space)) { Open(); } } if (!isOpen && room.getIsOpen()) { sRenderer.material = highlight; openButton.SetActive(true); } else { sRenderer.material = defult; openButton.SetActive(false); } }
private void OnTriggerExit(Collider otherobject) { if (otherobject.gameObject.GetComponent <playerMovement>()) { inRange = null; } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") //if player collects growup { GameObject go = GameObject.Find("Player"); playerCollision player_col = go.GetComponent <playerCollision>(); float total_Children = player_col.getTotalChildren(); total_Children += 1; //increase its total children player_col.setTotalChildren(total_Children); Destroy(this.gameObject); //destroy collected one playerMovement player_mov = go.GetComponent <playerMovement>(); //instantiate new cube GameObject a = Instantiate(myPrefab, new Vector3(other.transform.position.x, (other.transform.position.y + (total_Children * 1.1f)), other.transform.position.z), Quaternion.identity); rb = a.GetComponent <Rigidbody>(); a.transform.parent = other.GetComponent <Rigidbody>().transform; //add it into the list player_col.growUp_list.Add(a); } }
// Update is called once per frame void Update() { for (int i = 0; i < playerPool.childCount; i++) { if (playerPool.GetChild(i).gameObject.activeSelf) { playerMovement pMove = playerPool.GetChild(i).GetComponent <PlayerInfo>().thisPlayerMove; inputMovement = new Vector3(InputManager.Devices[i].LeftStick.X, 0, InputManager.Devices[i].LeftStick.Y); pMove.MovePlayer(inputMovement); inputRotation = new Vector3(InputManager.Devices[i].RightStick.X, 0, InputManager.Devices[i].RightStick.Y); pMove.RotatePlayer(inputRotation); } } //inputMovement = new Vector3(InputManager.ActiveDevice.LeftStick.X, 0, InputManager.ActiveDevice.LeftStick.Y); //playerMovement.MovePlayer(inputMovement); //inputRotation = new Vector3 (InputManager.ActiveDevice.RightStick.X,0,InputManager.ActiveDevice.RightStick.Y); //playerMovement.RotatePlayer(inputRotation); for (int i = 0; i < InputManager.Devices.Count; i++) { if (InputManager.Devices[i].RightTrigger.WasPressed) { if (playerPool.GetChild(i).gameObject.activeSelf) { playerPool.GetChild(i).GetComponent <PlayerInfo>().thisPlayerShoot.Shoot(); } } } }
IEnumerator ElevatorRide() { rideComplete = false; myMusic.Play(); myRideSound.Play(); SceneManager.MoveGameObjectToScene(myElevator, SceneManager.GetSceneAt(0)); travelTimer = 0; while (!loadingDone) { travelTimer += Time.deltaTime; yield return(null); } foreach (GameObject gameObject in SceneManager.GetSceneAt(2).GetRootGameObjects()) { if (gameObject.name == "Elevator") { otherElevator = gameObject; } } MusicManager.instance.StopClip(oldScene.name, true); SceneManager.UnloadSceneAsync(oldScene.buildIndex); GlobalGameStateManager.instance.LoadState(GameStateManager.instance.gameState); GameStateManager.instance.InitiateGameState(); while (loadingDone && travelTimer < travelTime) { travelTimer += Time.deltaTime; yield return(null); } float angularDifference = otherElevator.transform.rotation.eulerAngles.y - myElevator.transform.rotation.eulerAngles.y; GameObject playerParent = new GameObject("PlayerParent"); CameraController camController = CameraController.instance; Transform currentCamTrans = camController.currentCam.transform; playerMovement playerMoveScript = player.GetComponent <playerMovement>(); playerParent.transform.position = myElevator.transform.position; playerParent.transform.rotation = myElevator.transform.rotation; player.transform.parent = playerParent.transform; currentCamTrans.parent = playerParent.transform; playerParent.transform.position = otherElevator.transform.position; playerParent.transform.RotateAround(otherElevator.transform.position, Vector3.up, angularDifference); player.transform.parent = null; currentCamTrans.parent = null; camController.ResetToPlayer(); playerMoveScript.currentForward = new Vector3(currentCamTrans.forward.x, 0, currentCamTrans.forward.z).normalized; playerMoveScript.currentRight = new Vector3(currentCamTrans.right.x, 0, currentCamTrans.right.z).normalized; myMusic.Stop(); myRideSound.Stop(); myArrivalDing.Play(); otherElevator.GetComponent <OpenElevator>().rightDoorAnim.SetTrigger("playerInteraction"); otherElevator.GetComponent <OpenElevator>().leftDoorAnim.SetTrigger("playerInteraction"); MusicManager.instance.PlayClip(otherElevator.scene.name, true); while (myArrivalDing.isPlaying) { yield return(null); } Destroy(myElevator.gameObject); Destroy(playerParent); }
void Awake() { anim = GetComponent <Animator>(); //绑定动画 // playerAudio = GetComponent<AudioSource>(); pMovement = GetComponent <playerMovement>(); //绑定移动脚本 pShooting = GetComponentInChildren <playerShoot> (); currentHealth = startingHealth; //设置初始生命值 }
// Use this for initialization void Start() { player = GameObject.Find("Player"); anim = player.GetComponent <Animator>(); playerMovement = player.GetComponent <playerMovement>(); GameInfo = GameObject.Find("GameInfo"); playerScore = GameInfo.GetComponent <playerScore>(); }
private void Start() { bcGun = GetComponent <BoxCollider>(); rbGun = GetComponent <Rigidbody>(); plScript = player.GetComponent <playerMovement>(); anim = player.GetComponent <Animator>(); audioSource = GetComponent <AudioSource>(); }
// Use this for initialization void Start() { powerUpSpawnTimer = 5; powerUpFrequency = 3; pm = player.GetComponent <playerMovement>(); spawn(-30); }
// Start is called before the first frame update void Start() { Physics2D.IgnoreLayerCollision(8, 11); player = GameObject.FindGameObjectWithTag("Player"); playerState = player.GetComponent <playerBase>(); playerMov = player.GetComponent <playerMovement>(); anim = GetComponent <animHandler>(); }
// Start is called before the first frame update void Start() { powerupDurationCounter = 10f; dt = FindObjectOfType <distanceTravelled>(); dh = FindObjectOfType <playerDamageHandler>(); pm = FindObjectOfType <playerMovement>(); }
void Start () { dialogueScript = dialogueManager.GetComponent<Dialogue> (); entranceScript = gameObject.GetComponent<Entrance>(); playerMovementScript = gameObject.GetComponent<playerMovement>(); dancingScript = giraffe.GetComponent<dancing>(); endGameScript = gameObject.GetComponent<EndGame> (); }
//bool isDead; void Awake() { pHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <playerHealth>(); anim = GetComponent <Animator>(); //绑定动画 pMovement = GetComponent <playerMovement>(); //绑定自定义引动脚本 pShooting = GetComponentInChildren <playerShoot>(); currentTime = startingTime; //设置初始生命值 }
// Use this for initialization void Start() { player = FindObjectOfType<playerMovement> (); throwVelocity = (originalThrowVelocity + player.GetComponent<Rigidbody2D> ().velocity.x); if (player.transform.localScale.x < 0){ throwVelocity = -originalThrowVelocity + player.GetComponent<Rigidbody2D> ().velocity.x; GetComponent<Transform> ().localScale = new Vector2 (-1.680365f, transform.localScale.y); } }
public Player(GameObject gameObject, uint playerNumber, playerClass pc) { myGameObject = gameObject; this.playerNumber = playerNumber; myPlayerMovement = myGameObject.GetComponent<playerMovement>(); characterController = myGameObject.GetComponent<CharacterController>(); myPlayerMovement.thisPlayer = PlayerNumConverter.IndexToPlayerNum(playerNumber); myPlayerMovement.myClass = pc; }
void Start() { playerCharacter = GameObject.Find("Player"); p_Move = playerCharacter.GetComponent<playerMovement>(); }
// Use this for initialization void Start() { singleton = GameObject.FindGameObjectWithTag ("DontDestroy"); sS = singleton.GetComponent<GlobalSingleton> (); ownParticles = GetComponentInChildren<ParticleSystem> (); particleColor = ownParticles.startColor; ownParticles.Play (); player = GameObject.FindGameObjectWithTag ("Player"); trail = GetComponent<TrailRenderer> (); playerS = player.GetComponent<playerMovement> (); if(!sS.inMenu){ bulletManager = GameObject.FindGameObjectWithTag ("BulletManager"); timerStart = bulletManager.GetComponent<BulletManager> ().bulletTimer; } timer = timerStart; }
// Use this for initialization void Start() { healthScript = GetComponent<playerMovement>(); originalInvulrableTime = invulrableTime; }
// Use this for initialization void Start() { pls = player.GetComponent<playerMovement> (); blocksAvailable = BlocksTotal; blockMoveEffect = GetComponentInChildren<ParticleSystem> (); }
// Use this for initialization void Start() { bulletTimerText = GetComponent<TextMesh> (); //warningSystem = GetComponentInChildren<ParticleSystem> (); playerS = player.GetComponent<playerMovement> (); heartScr = heart.GetComponent<heartScript> (); timerZeroSound = GetComponent<AudioSource> (); scaleInitialSize = scaleObject.transform.localScale; scaleInitialSize2 = scaleObject2.transform.localScale; barScale = new Vector3(0f,0.4775151f,1); }
// Use this for initialization void Start() { healthScript = GetComponent<playerMovement>(); }
// Use this for initialization void Start() { player = FindObjectOfType<playerMovement> (); isFollowing = true; }
// Use this for initialization void Start () { GameObject playerObject = GameObject.FindGameObjectWithTag("Player"); playerSpeed = playerObject.GetComponent<playerMovement>(); }