void Awake() { characterController = GetComponent <CharacterController> (); camera = Camera.main; mouseLook = new MouseLook(); mouseLook.Init(transform, camera.transform); weapon = gameObject.GetComponent <PlayerWeapon> (); light = gameObject.GetComponent <PlayerLight> (); interact = gameObject.GetComponent <PlayerInteract> (); buffs = gameObject.GetComponent <PlayerBuffs> (); traps = gameObject.GetComponent <PlayerTraps> (); ability1 = gameObject.GetComponent <PlayerAbility1> (); health = gameObject.GetComponent <PlayerHealth> (); aim = gameObject.GetComponent <HumanAim> (); grenade = GetComponent <PlayerGrenade> (); player = GetComponent <Player> (); animator = GetComponentInChildren <Animator> (); audio = GetComponentInChildren <AudioSource> (); gameManager = FindObjectOfType <GameManager> (); IsWalking = false; IsRunning = false; IsJumping = false; verticalSpeed = 0f; timer = 0f; jetPackTimer = jetPackTime; }
// Start is called before the first frame update void Start() { //找到玩家的能量 Energy = GameObject.FindGameObjectsWithTag("PlayerEnergy"); for (int i = 0; i < Energy.Length; i++) { for (int j = i; j < Energy.Length; j++) { if (Energy[i].transform.position.x > Energy[j].transform.position.x) { GameObject temp = Energy[i]; Energy[i] = Energy[j]; Energy[j] = temp; } } } playerLight = GameObject.Find("PlayerLight").GetComponent <PlayerLight>(); playerMove = this.transform.GetComponent <PlayerMove>(); enemy = GameObject.FindGameObjectWithTag("Enemy").GetComponent <Enemy>(); //GameObject.FindGameObjectWithTag this.playDeathTime = timeAll; }
void Awake() { playerLight = GetComponent <PlayerLight>(); attacker = GetComponentInChildren <IAttackable>(); damageControl = GetComponentInChildren <IDamagable>(); updateUI = GetComponent <UpdatePlayerUI>(); }
void Start() { timerforfacingvectorupdate = 2.0f; timerforfacingvectorupdate2 = 2.0f; AttackTimer = .5f; AbleToMelee = false; EnragedSoundPlaying = false; heroEquipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); Playsounds = gameObject.GetComponent <AudioSource>(); //Random.seed = 42; player = GameObject.FindGameObjectWithTag("Player"); playerLight = player.GetComponent <PlayerLight>(); playMove = player.GetComponent <PlayerMovement>(); ShadowHealth = GetComponent <Health>(); Moveto = new Vector3(0, 0); controller = GetComponent <CharacterController>(); speed = 1; timerCount = 1; DmgTimer = 1; maxSpeed = 1; timer = 1; playerConsumeTimer = 1; newWayPoint = true; stuckCounter = 0; DistancetoLight = 100; DistancetoPlayer = 100; //AnimTimer = 1; }
//=========================================================================== // | // 玩家系统函数 | // | //=========================================================================== //====================================================== // 玩家初始化函数 //====================================================== void init() { // 拾取操作对象 rigidbody = GetComponent <Rigidbody2D> (); // 获取玩家刚体 animator = GetComponent <Animator> (); // 获取玩家动画控制器 startPoint = findedStartPoint(); if (startPoint == null) { startPoint = GameObject.FindGameObjectWithTag("StartPoint"); } slowDownCheck = transform.Find("slowDownCheck").gameObject.GetComponent <SlowDownCheck> (); playerLight = transform.Find("playerLight").gameObject.GetComponent <PlayerLight> (); // hp.HPStrip = GetComponentInChildren<Slider> (); // sePlayer = GetComponent<AudioSource> (); groundCheckPoint = transform.Find("GroundCheckPoint").gameObject; //从子对象获取着地碰撞判定 groundLayer = 1 << LayerMask.NameToLayer("Ground"); //获取地面图层 isFacingRight = true; // 初始朝向右 isWannaToExitSlowDown = false; // hp.init (initHp); state = State.standby; //初始状态为待机 rushPower.init(initMaxPower); //初始化玩家能量 initGravity = rigidbody.gravityScale; inputOperation.init(isMac); flashMoveTo(startPoint.transform.position); moveStop(); }
void Start() { canMove = true; //used for respawn startPosition = new Vector3(this.transform.position.x, this.transform.position.y, 0f); //gather componenets player = ReInput.players.GetPlayer(playerId); sprite = GetComponent <SpriteRenderer>(); body2D = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); playerTag = GetComponent <PlayerTag>(); playerLight = GetComponent <PlayerLight>(); // value holds playerHorizSpeedHold = playerHorizSpeed; playerVertSpeedHold = playerVertSpeed; deathTimerHold = deathTimer; //If we want to implement changing main player mid game if (sharedData.currentMainPlayer == playerId) { playerTag.enabled = false; playerLight.enabled = true; } else if (sharedData.currentMainPlayer != playerId) { playerTag.enabled = true; playerLight.enabled = false; } }
void Awake() { //Get Components animationComponent = GetComponent <PlayerAnimation>(); movementComponent = GetComponent <PlayerMovement>(); shootingComponent = GetComponent <PlayerShooting>(); lightComponent = GetComponent <PlayerLight>(); }
private void Start() { pv = GetComponent <PhotonView>(); laderCor = LaderCor(); statMgr = transform.GetChild(0).GetComponent <StatManager>(); light = transform.GetChild(1).GetComponent <PlayerLight>(); offStat = transform.GetChild(0).GetComponent <offlineStat>(); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); heroLight = player.gameObject.GetComponent <PlayerLight>(); cameras = GameObject.FindObjectOfType <Camera>(); theoptions = GameObject.Find("TheOptions").GetComponent <Options>(); temp = Instantiate(TooltipWindow); temp.SetActive(false); }
// Use this for initialization private void Start() { m_CharacterController = GetComponent <CharacterController>(); m_Camera = Camera.main; m_OriginalCameraPosition = m_Camera.transform.localPosition; m_FovKick.Setup(m_Camera); m_HeadBob.Setup(m_Camera, m_StepInterval); m_StepCycle = 0f; m_NextStep = m_StepCycle / 2f; m_Jumping = false; m_AudioSource = GetComponent <AudioSource>(); m_MouseLook.Init(transform, m_Camera.transform); playerLight = gameObject.GetComponent <PlayerLight>(); startingMaxLightValue = playerLight.lightLeft; //Set default state isFiring = false; //Set the gun object gun = GameObject.FindGameObjectWithTag("gun"); gunInitialScale = gun.transform.localScale; //Set the gun color switch (playerLight.playerLightType) { case TypeOfLight.White: gun.GetComponent <Renderer>().material = Resources.Load("Solid_Always_Lit/White_Mat") as Material; break; case TypeOfLight.Red: gun.GetComponent <Renderer>().material = Resources.Load("Solid_Always_Lit/Red_Mat") as Material; break; case TypeOfLight.Orange: gun.GetComponent <Renderer>().material = Resources.Load("Solid_Always_Lit/Orange_Mat") as Material; break; case TypeOfLight.Yellow: gun.GetComponent <Renderer>().material = Resources.Load("Solid_Always_Lit/Yellow_Mat") as Material; break; case TypeOfLight.Green: gun.GetComponent <Renderer>().material = Resources.Load("Solid_Always_Lit/Green_Mat") as Material; break; case TypeOfLight.Blue: gun.GetComponent <Renderer>().material = Resources.Load("Solid_Always_Lit/Blue_Mat") as Material; break; case TypeOfLight.Violet: gun.GetComponent <Renderer>().material = Resources.Load("Solid_Always_Lit/Violet_Mat") as Material; break; } }
void Start() { heroLight = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerLight>(); player = GameObject.FindGameObjectWithTag("Player"); particles = gameObject.GetComponentInChildren <ParticleSystem>(); particleLight = gameObject.GetComponent <Light>(); sprite = gameObject.GetComponent <SpriteRenderer>(); active = true; deathTimer = 0; once = true; }
void Start() { x = Random.Range(-velocityMax, velocityMax); y = Random.Range(-velocityMax, velocityMax); xMax = transform.localPosition.x + xMax; yMax = transform.localPosition.y + yMax; xMin = transform.localPosition.x + xMin; yMin = transform.localPosition.y + yMin; volume = 0.5f; PlayerLightComponent = PlayerLight.Instance; }
void Start() { player = PlayerController.playerObject.GetComponent <PlayerLight>(); sources = GetComponents <AudioSource>(); for (int i = 0; i < sources.Length; i++) { sources[i].volume = 0; volume[i] = sources[i].volume; } sources[0].volume = 1; }
void Start() { anim = gameObject.GetComponent <Animator>(); heroEquipment = gameObject.GetComponent <PlayerEquipment>(); heroCooldowns = gameObject.GetComponent <PlayerCooldowns>(); heroLight = gameObject.GetComponent <PlayerLight>(); UICD = GameObject.Find("Health bar").GetComponent <HUDCooldowns>(); playersLight = gameObject.GetComponentInChildren <Light>(); audioPlayer = gameObject.GetComponent <AudioSource>(); chained = false; shoot = false; shootTimer = 0; }
void OnTriggerEnter(Collider col) { if (col.gameObject.tag == "player") { PlayerLight pLight = player.GetComponent <PlayerLight>(); pLight.lightLeft = pLight.maxLight; col.GetComponent <FirstPersonController>().ShrinkGunFunction(); if (debugMode) { Debug.Log("player light replenished!"); } Destroy(gameObject); } }
void FixedUpdate() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player"); if (player != null) { theLight = player.GetComponent <PlayerLight>(); } } transform.up = (player.transform.position - transform.position).normalized; transform.position += transform.up * speed * Time.deltaTime; }
private void Update() { if (!playerLight) { playerLight = FindObjectOfType <PlayerLight>(); } if (!playerLight) { return; } bar.fillAmount = playerLight.LightLevel; bar.color = gradient.Evaluate(playerLight.LightLevel); }
private void Start() { m_WaxController = GetComponentInParent <PlayerWax>(); m_LightController = GetComponentInParent <PlayerLight>(); m_AnimatorController = GetComponent <Animator>(); InputHandler.instance.MoveUp += OnMoveUp; InputHandler.instance.MoveDown += OnMoveDown; InputHandler.instance.MoveLeft += OnMoveLeft; InputHandler.instance.MoveRight += OnMoveRight; InputHandler.instance.MoveUpDone += OnMoveUpDone; InputHandler.instance.MoveDownDone += OnMoveDownDone; InputHandler.instance.MoveLeftDone += OnMoveLeftDone; InputHandler.instance.MoveRightDone += OnMoveRightDone; }
void Update() { if (timerActive) { timeInFloat += 1 * Time.deltaTime; currentSeconds += 1 * Time.deltaTime; } if (currentSeconds > 60) { currentMinutes++; currentSeconds = 0; } ///////makin' strings pretty string secondsString; string minutesString; if (Mathf.Round(currentSeconds) < 10) { secondsString = "0" + Mathf.Round(currentSeconds); } else { secondsString = "" + Mathf.Round(currentSeconds); } if (Mathf.Round(currentMinutes) < 10) { minutesString = "0" + Mathf.Round(currentMinutes); } else { minutesString = "" + Mathf.Round(currentMinutes); } /////// timerText.text = minutesString + ":" + secondsString; if (PlayerController.playerObject != null) { PlayerLight playerLight = PlayerController.playerObject.GetComponent <PlayerLight>(); float percentageLight = (playerLight.remainingLight / playerLight.maxLight); lightSlider.localScale = new Vector2(percentageLight, 1); } }
void Start() { earthtrailtime = 0; anim = gameObject.GetComponent <Animator>(); controller = gameObject.GetComponent <CharacterController>(); heroEquipment = gameObject.GetComponent <PlayerEquipment>(); heroLight = gameObject.GetComponent <PlayerLight>(); heroCooldowns = gameObject.GetComponent <PlayerCooldowns>(); trailBlazerDropTimer = 0.0f; UICD = GameObject.Find("Health bar").GetComponent <HUDCooldowns>(); aPlayer = gameObject.GetComponent <AudioSource>(); once = false; theoptions = GameObject.Find("TheOptions").GetComponent <Options>(); move = GetComponent <PlayerMovement>(); }
// Use this for initialization void Start() { currentSelection = 0; maxchoices = 1; AxisChanged = false; easyMode = GameObject.FindObjectOfType <Options>().easyMode; if (Application.loadedLevelName == "Game") { generator = GameObject.FindGameObjectWithTag("Dungeon").GetComponent <RoomGeneration>(); } playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <Health>(); dasLicht = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerLight>(); equipment = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerEquipment>(); anim = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>(); }
// Start is called before the first frame update void Start() { hullMaxHealth = 100.0f; hullCurrentHealth = 100.0f; hullDurability = 10.0f; pMovement = GetComponent <PlayerMovement>(); upgrades = GetComponent <PlayerUpgrades>(); playerLight = pLight.GetComponent <PlayerLight>(); sonarScan = sonarSystem.GetComponent <SonarScan>(); shieldTexture = sub_shield.GetComponent <SpriteRenderer>(); backLight = lightUpgrade.GetComponentInChildren <Light2D>(); lightTexture = lightUpgrade.GetComponentInChildren <SpriteRenderer>(); sonarTexture = sonarUpgrade.GetComponentInChildren <SpriteRenderer>(); }
private void Start() { mov = FindObjectOfType <PlayerMovement>(); sL = FindObjectOfType <SceneLoader>(); pl = FindObjectOfType <Player>(); vM = FindObjectOfType <ValueManagement>(); bg = FindObjectOfType <Background>(); pLight = FindObjectOfType <PlayerLight>(); willpower = FindObjectOfType <Willpower>(); dM = FindObjectOfType <DateManagement>(); TurnOffDev(); fakeLeftButton.gameObject.SetActive(false); fakeRightButton.gameObject.SetActive(false); fakeJumpButton.gameObject.SetActive(false); cancelInsteadButton.gameObject.SetActive(false); ShowUI(); ShowWillpowerGOs(); //for testing //checkpointAllowed = vM.GetBoughtCheckpoints(); //slowAllowed = vM.GetBoughtSlowdowns(); //insteadAllowed = vM.GetBoughtInsteads(); checkpointAllowed = 3; slowAllowed = 3; insteadAllowed = 3; /////////////////////// checkpointCount = PlayerPrefs.GetInt("checkpointCount", 0); slowCount = PlayerPrefs.GetInt("slowCount", 0); insteadCount = PlayerPrefs.GetInt("insteadCount", 0); UpdateWillpower(); keyImage.color = Colors.toggleGrayColor; SkillsEnabled(); ShouldShowInsteadText(); UpdateInsteadSlots(); ShouldShowSlowdownText(); UpdateSlowSlots(); ShouldShowCheckpointUIAndText(); ShouldShowLoadCheckpoint(); UpdateCheckSlots(); dayNumber.text = "Day " + sL.GetCurrentSceneName(); }
void Awake() { m_Rigidbody2D = GetComponent <Rigidbody2D>(); spriteRenderer = GetComponent <SpriteRenderer>(); animator = GetComponentInChildren <Animator>(); playerLight = GetComponentInChildren <PlayerLight>(); playerBullet = GetComponentInChildren <PlayerBullet>(); boxCollider2D = GetComponent <BoxCollider2D>(); gravity = m_Rigidbody2D.gravityScale; DontDestroyOnLoad(this.gameObject); OnInteractionEvent += (collider2D) => { collider2D.GetComponent <IInteractive>()?.Interactive(); }; }
void Start() { heroLight = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerLight>(); particles = gameObject.GetComponentInChildren <ParticleSystem>(); particleLight = gameObject.GetComponent <Light>(); sprite = gameObject.GetComponent <SpriteRenderer>(); active = true; deathTimer = 0; once = true; player = GameObject.FindGameObjectWithTag("Player"); allObjects = GameObject.FindObjectsOfType <GameObject>(); foreach (GameObject obj in allObjects) { obj.SendMessage("AddDrop", this.gameObject, SendMessageOptions.DontRequireReceiver); } }
public Player() : base(Vector2.Zero, Player_Sprite, ORIGINAL_WIDTH, ORIGINAL_HEIGHT, Drawing.DrawOrder.ENTITIES) { AddAnimation("walk_d", CreateAnimFrameArray(1, 0), 6, true); AddAnimation("walk_r", CreateAnimFrameArray(2, 3), 8, true); AddAnimation("walk_u", CreateAnimFrameArray(4, 5), 6, true); AddAnimation("walk_l", CreateAnimFrameArray(6, 7), 8, true); AddAnimation("attack_d", CreateAnimFrameArray(8, 9), 10, false); AddAnimation("attack_r", CreateAnimFrameArray(10, 11), 10, false); AddAnimation("attack_u", CreateAnimFrameArray(12, 13), 10, false); AddAnimation("attack_l", CreateAnimFrameArray(14, 15), 10, false); AddAnimation("fall", CreateAnimFrameArray(28, 29, 30, 31), 5, false); AddAnimation("slumped", CreateAnimFrameArray(32)); AddAnimation("whirl", CreateAnimFrameArray(25, 26, 27, 24), 12, true); AddAnimation("idle_d", CreateAnimFrameArray(24), 4, true); AddAnimation("idle_r", CreateAnimFrameArray(25), 4, true); AddAnimation("idle_u", CreateAnimFrameArray(26), 4, true); AddAnimation("idle_l", CreateAnimFrameArray(27), 4, true); AddAnimation("jump_d", CreateAnimFrameArray(16, 17), 4, true); AddAnimation("jump_r", CreateAnimFrameArray(18, 19), 4, true); AddAnimation("jump_u", CreateAnimFrameArray(20, 21), 4, true); AddAnimation("jump_l", CreateAnimFrameArray(22, 23), 4, true); AddAnimation("idle_climb", CreateAnimFrameArray(33)); AddAnimation("climb", CreateAnimFrameArray(34, 35), 8, true); height = HITBOX_HEIGHT; offset = new Vector2(3, DEFAULT_Y_OFFSET); width = HITBOX_WIDTH; Play("idle_u"); ANIM_STATE = PlayerAnimState.as_idle; facing = Facing.UP; broom = new(this); transformer = new(this); shadow = new(this, new Vector2(3, -1), fps : 20); foot_overlay = new(this); reflection = new(this); light = new(this); }
void SignatureMove() { playMove = player.GetComponent <PlayerMovement>(); if (playMove != null) { PlayerLight playHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerLight>(); playHealth.currentLight = 0; playMove.PullThePlayer(transform.position); if (doOnce) { Instantiate(PullParticles, player.transform.position, new Quaternion(0, 0, 0, 0)); doOnce = false; float RandX = Random.Range(-5, 5); float RandY = Random.Range(-5, 5); gameObject.GetComponent <GenerateLoot>().DropAPieceOfGear(new Vector3(transform.position.x + RandX, transform.position.y + RandY, -1)); } } }
void BlindedByTheLight() { PlayerLight ReturnLight = player.GetComponent <PlayerLight>(); ShadowHealth = GetComponent <Health>(); if (ShadowHealth != null) { ShadowHealth.LoseHealth(StoredLight); } StoredLight += 8; Instantiate(BlindedParts, transform.position, transform.rotation); Instantiate(ReturningParts, transform.position, transform.rotation); ReturnLight.currentLight += StoredLight; if (ReturnLight.currentLight > ReturnLight.maxLight) { ReturnLight.currentLight = ReturnLight.maxLight; } StoredLight = 0; }
void Start() { //Reference Initializations: gameStateDataScriptRef = GameObject.Find("GameState").GetComponent <GameStateScript>(); BaseWorldSpawnRef = GameObject.Find("BaseWorldSpawn"); //File selector: Default upper left boat selected highlightedFilenum = 1; highlightedFile[0] = false; highlightedFile[1] = false; /* * SelectorEnvironment = GameObject.Find("MENU_PORT"); * FileSelectorBoat1 = SelectorEnvironment.transform.GetChild(0).gameObject; * FileSelectorBoat2 = SelectorEnvironment.transform.GetChild(1).gameObject; * FileSelectorBoat3 = SelectorEnvironment.transform.GetChild(2).gameObject; * FileSelectorBoat4 = SelectorEnvironment.transform.GetChild(3).gameObject; */ input = PlayerInput.instance; light = GetComponent <PlayerLight>(); amount = light.healthDrainAmmount; }
private void Start() { m_PlayerLight = GetComponent <PlayerLight>(); InputHandler.instance.ConsumeCandle += OnConsumeCandle; }
void Awake() { playerLight = transform.Find("PlayerLight").GetComponent <PlayerLight>(); }
private void Awake() { if (Instance != null) return; Instance = this; }