// Use this for initialization void Awake () { player = GameObject.FindGameObjectWithTag("Player"); playerControl = player.GetComponent<playerControl>(); som = gameObject.GetComponent<AudioSource>(); bala = gameObject.GetComponent<MeshRenderer>(); }
private void Start() { dragon = GetComponent <playerControl>(); FaceRandomGroundDirection(); // so they're not all facing the same direciton when you load the game State = StartState; }
void Start() { move = GameObject.Find("FPSController").GetComponent <playerControl>(); leftClicked = 0; rightClicked = 0; isActive = false; isTalking = false; showDance = false; findLeave = false; questComplete = false; if (textFiles != null) { textLines = (textFiles.text.Split('\n')); } currentLine = 0; if (endAtLine == 0) { endAtLine = textLines.Length - 1; } DisableTextBox(); DisableButton(); }
public void TakeDamage(int damageAmount) { if (dying) { return; } health -= damageAmount; if (health <= 0) { if (photonView.IsMine) { playerControl player = GetComponent <playerControl> (); if (player == null) { PhotonNetwork.Destroy(this.gameObject); } else { //player died routine, handle this player.enabled = false; dying = true; player.ourRigidbody.AddForce(player.transform.up * 100, ForceMode.VelocityChange); RespawnEntity(); } } } }
void Awake () { shootLine = GetComponent<LineRenderer>(); shootLuz = GetComponent<Light>(); playerControl = player.GetComponent<playerControl>(); somDisparo = GetComponent<AudioSource>(); }
private playerControl playerControl; //用于获取相关持续时间 private void Awake() { playerControl = GetComponent <playerControl>(); healthBar = GameObject.Find("blood").GetComponent <SpriteRenderer>(); healthScale = healthBar.transform.localScale; healthPos = GameObject.Find("blood").transform; }
// Use this for initialization void Start () { player = GameObject.FindGameObjectWithTag("Player"); playerControl = GameObject.FindGameObjectWithTag("Player").GetComponent<playerControl>(); escape = GameObject.FindGameObjectWithTag("prisioner").GetComponent<prisionerEscape>(); audios = GetComponents<AudioSource>(); }
void Awake() { time = gameObject.AddComponent("Timer") as Timer; pathMemory = new Transform[3]; playerCtrl = GameObject.Find("Player").GetComponent<playerControl>(); anim = GetComponent<Animator>(); }
public PlayerDead(playerControl p) { player = p; animator = p.animator; playerBody = p.GetComponent <Rigidbody>(); spriteRenderer = p.GetComponent <SpriteRenderer>(); }
// Use this for initialization void Start() { m_Rigidbory = GetComponent <Rigidbody>(); m_playerCtrl = GameObject.Find("footman").transform.GetComponent <playerControl>(); m_Animator = m_playerCtrl.anim; MakeFSM(); }
public PlayerShoot(playerControl p) { player = p; playerBody = p.GetComponent <Rigidbody>(); projectile = p.projectile.gameObject; projAtk = projectile.GetComponent <ProjectileAttack>(); input = p.input; }
void Awake() { anim = GetComponent <Animator>(); playerMovement = GetComponent <playerControl>(); hash = GameObject.FindGameObjectWithTag("MainControl").GetComponent <HashIDs>(); //sceneFadeOut = GameObject.FindGameObjectWithTag("fader").GetComponent<SceneFadeInOut>(); lastPlayerSighting = GameObject.FindGameObjectWithTag("MainControl").GetComponent <EnemySight>().lastPlayerSighting; }
// Use this for initialization void Start() { Player = FindObjectOfType <playerControl>(); if (Player.transform.localScale.x < 0) { speed = -speed; } }
// Start is called before the first frame update void Start() { Transform prnt = transform.parent; heightOffset = transform.position.y; player = GameObject.Find("player"); playerScript = player.GetComponent <playerControl>(); }
public static playerControl singletonGetInstance() { if (_PControlInstance == null) //If no instance, make one. { _PControlInstance = new playerControl(); } return(_PControlInstance); }
public PlayerMelee(playerControl p, float hm) { player = p; meleeAttack = p.basicAttack.gameObject; input = p.input; horizontalMovement = hm; animator = p.gameObject.GetComponent <Animator>(); }
public PlayerGlide(playerControl p, glideType glideMethod) { player = p; input = p.input; method = glideMethod; animator = p.gameObject.GetComponent <Animator>(); spriterenderer = p.gameObject.GetComponent <SpriteRenderer>(); }
// public bool checkpointReached; // Use this for initialization void Start() { bombSpriteRenderer = GetComponent <SpriteRenderer>(); gamePlayer = FindObjectOfType <playerControl>(); // RestartButton.SetActive(false); Menu.SetActive(false); HighScorePanel.SetActive(false); GameOverText.SetActive(false); }
public PlayerDodge(playerControl p) { player = p; playerRenderer = p.gameObject.GetComponent <SpriteRenderer>(); playerColor = playerRenderer.color; playerBody = p.gameObject.GetComponent <Rigidbody>(); animator = p.gameObject.GetComponent <Animator>(); input = p.input; }
void OnCollisionEnter2D(Collision2D collision) { playerControl x = collision.gameObject.GetComponent <playerControl>(); if (x != null) { SceneManager.LoadScene("win"); } }
public PlayerJump(playerControl p) { player = p; jump = p.gameObject.GetComponentInChildren <AudioSource>(); playerBody = p.gameObject.GetComponent <Rigidbody>(); myAnimationState = "PlayerJumpUp"; animator = p.gameObject.GetComponent <Animator>(); spriterenderer = p.gameObject.GetComponent <SpriteRenderer>(); input = p.input; }
public PlayerTether(playerControl p) { player = p; playerRB = p.GetComponent <Rigidbody>(); tetherDirection = p.tetherAbility.activeTetherPoint.transform.position - playerRB.position; tetherLength = tetherDirection.magnitude; angle = Vector3.SignedAngle(tetherDirection, Vector3.up, Vector3.forward) * Mathf.Deg2Rad; animator = p.gameObject.GetComponent <Animator>(); spriterenderer = p.gameObject.GetComponent <SpriteRenderer>(); input = p.input; }
void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { playerControl playerController = other.gameObject.GetComponent <playerControl>(); if (playerController != null && !playerController.IsDashing) { DestroyProjectile(); } } }
public PlayerMove(playerControl p, bool isAirborne) { player = p; playerBody = p.gameObject.GetComponent <Rigidbody>(); input = p.input; isFlying = isAirborne; //Trying to pass a reference to the Animator/Renderer components here. animator = p.gameObject.GetComponent <Animator>(); spriterenderer = p.gameObject.GetComponent <SpriteRenderer>(); }
// Start is called before the first frame update void Start() { checkpoints = GameObject.FindGameObjectsWithTag("Checkpoint"); groundedEnemiesArray = GameObject.FindGameObjectsWithTag("GroundedEnemy"); CopyArray(); playerState = player.GetComponent <playerControl>(); spawn = GameObject.Find("Spawn"); totalNumberEnemies = groundedEnemiesArray.Length; //groundedEnemy = GameObject.Find("GroundedEnemy"); enemyRef = Resources.Load("GroundedEnemy"); // Will be used for cloning , typeof(GameObject) }
// Use this for initialization void Awake () { player = GameObject.FindGameObjectWithTag("Player"); playerControl = GameObject.FindGameObjectWithTag("Player").GetComponent<playerControl>(); chave = GetComponent<MeshRenderer>(); enemy = GameObject.FindGameObjectWithTag("enemy").GetComponent<EnemyHealth>(); colliderChave = gameObject.GetComponent<Collider>(); som = gameObject.GetComponent<AudioSource>(); colliderChave.enabled = false; chave.enabled = false; enemyKilled = false; }
void Start() { invNum = 0; timer = 0; cont = GetComponentInParent <playerControl> (); temp = null; cameraMode = false; pickUp = false; viewfinder.SetActive(false); flash = GameObject.Find("Flash").GetComponent <cameraFlash> (); fov = 60; }
// Use this for initialization void Start() { HP = 2f; monsterSpeed = 1.5f; int seed = (int)(transform.position.x * 100) + (int)(transform.position.z * 100) + (int)(Time.time * 20); System.Random ran = new System.Random(seed); freeMoveCD = constFreeMoveCD + (float)ran.Next(-100, 100) / 100; freeMoveTime = constFreeMoveTime + (float)ran.Next(-100, 100) / 100; player = GameObject.FindWithTag("Player").GetComponent <playerControl>(); rb = GetComponent <Rigidbody>(); }
void Start() { if(GameObject.FindGameObjectWithTag("Player")){ player = GameObject.FindGameObjectWithTag("Player").GetComponent<playerControl>(); } if(transform.parent){ if(transform.parent.GetComponent<CanvasScaler>()){ _canvasScale = ((CanvasScaler)transform.parent.GetComponent<CanvasScaler>()).referenceResolution; } } _screenScale = new Vector2(Screen.width, Screen.height); _orgPos = new Vector2(transform.position.x, transform.position.y); _currPos = _orgPos; adjustedMaxDis = AdjustMaxDistance(); }
void attack() { RaycastHit hit; Vector3 fwd = transform.TransformDirection(Vector3.forward); if (Physics.Raycast(transform.position, fwd, out hit, rayLength)) { if (hit.collider.gameObject.tag == "Tree") { Debug.Log("Hit"); treeScript = GameObject.Find(hit.collider.gameObject.name).GetComponent <treectrl>(); playerAnim = GameObject.FindWithTag("Player").GetComponent <playerControl>(); treeScript.treeHealth -= 1; } } }
void Start() { healthMax = 10; player = GameObject.Find("player"); playerScript = player.GetComponent <playerControl>(); Debug.Log("Health: " + playerScript.data.health); /* * CMDebug.ButtonUI(new Vector2(-100, 100), "heal", () => * { * healthSystem.Heal(2); * Debug.Log("Healed: " + healthSystem.GetHealth()); * }); */ }
// Old code //public GameObject skillButton; //public GameObject shieldButton; public void Start() { isDisplaying = true; player = GameObject.Find("player"); playerScript = player.GetComponent <playerControl>(); playerSkills = playerScript.GetPlayerSkills(); currency = GameObject.Find("collectables").transform.Find("currency").gameObject.GetComponent <Collectable>(); levelWindow = GameObject.Find("LevelWindow").GetComponent <LevelWindow>(); // Old code //skillButton = GameObject.Find("Canvas").transform.Find("ShieldButton").gameObject.GetComponent<>(); //EventSystem.current.SetSelectedGameObject(resumeButton); //skillTreeButton = canvas.transform.Find("ResumeButton"); //.GetComponent<ResumeButton>(); //"tranform.()FindObjectOfType<ResumeGame>().gameObject; }
void Start() { if (GameObject.FindGameObjectWithTag("Player")) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <playerControl>(); } if (transform.parent) { if (transform.parent.GetComponent <CanvasScaler>()) { _canvasScale = ((CanvasScaler)transform.parent.GetComponent <CanvasScaler>()).referenceResolution; } } _screenScale = new Vector2(Screen.width, Screen.height); _orgPos = new Vector2(transform.position.x, transform.position.y); _currPos = _orgPos; adjustedMaxDis = AdjustMaxDistance(); }
/// <summary> /// 根据初始数据DTO,初始化playerControl /// </summary> private void initPlayerControl(playerDTO dto) { //TODO设置DTO中的playerModel传递给playerControl以及id playerControl player = new playerControl(1, dto); //if这个id是和我方id一样的话,初始化技能面板 //初始化技能面板 if (dto.playerId == globalBattleControl.mainPlayerId) { mainPlayerTeamId = dto.playerTeamId; GameObject[] skillPanels = GameObject.FindGameObjectsWithTag("Skill"); foreach (var item in skillPanels) { skillManager skillManager = item.GetComponent <skillManager>(); int i = int.Parse(item.name.Substring(2)); ///这里明确,技能标号从1开始 skillManager.SetSkill(player.getPlayerModel().skillArray[i]); } } //初始化快捷键 if (dto.playerId == globalBattleControl.mainPlayerId) { mainPlayerTeamId = dto.playerTeamId; GameObject[] skillPanels = GameObject.FindGameObjectsWithTag("ShortKey"); foreach (var item in skillPanels) { shortKeyManager skillManager = item.GetComponent <shortKeyManager>(); int i = int.Parse(item.name.Substring(3)); ///这里明确,技能标号从1开始 skillManager.SetSoup(player.getPlayerModel().soupArray[i]); } } if (dto.playerTeamId == 1) { team1Dic.Add(dto.playerId, player); } else { team2Dic.Add(dto.playerId, player); } }
public static void SendGameData(byte[] data, playerControl player) { int offset = 0; while (offset < data.Length) { var temp = new byte[MAX_MESSAGE_SIZE]; for (int j = 0; j < MAX_MESSAGE_SIZE; j++) { if (j + offset == data.Length) { break; } temp[j] = data[offset + j]; } player.RpcGetGameData(temp, offset); offset += MAX_MESSAGE_SIZE; } }
//https://forum.unity.com/threads/character-align-to-surface-normal.33987 void Start() { if (planetCollider == null) { centre = transform; radius = 0; } else { //consider scale applied to planet transform (assuming uniform, just pick one) radius = planetCollider.radius * planetCollider.transform.localScale.y; centre = planetCollider.transform; } ourPlayer = GetComponent <playerControl> (); ourPlayer.ourGravityPlayer = this; //starting position at north pole // transform.position = centre.position + new Vector3(0,radius+height,0); }
// Use this for initialization void Start () { player = GetComponentInParent<playerControl>(); lanterna.enabled = false; }
// Use this for initialization void Start() { HideBut(); playerCtrl = GameObject.Find("Player").GetComponent<playerControl>(); }
void Start() { p1Selected = char1; p2Selected = char2; playerTracker.pT.p1.GetComponent<playerData>().playNum = 1; playerTracker.pT.p1.GetComponent<playerData>().charNum = 1; playerTracker.pT.p2.GetComponent<playerData>().playNum = 2; playerTracker.pT.p2.GetComponent<playerData>().charNum = 2; fightManager.fM.selCharacter = this; p1C = playerTracker.pT.p1.GetComponent<playerControl>(); p2C = playerTracker.pT.p2.GetComponent<playerControl>(); }
// Use this for initialization void Start() { prePos = currentPos; playerCtrl = GameObject.Find("Player").GetComponent<playerControl>(); points = CameraPositions.loadFirstLvl(); }