void Awake() { player = GameObject.FindGameObjectWithTag ("Player"); playerHealth = player.GetComponent <PlayerHealth> (); enemyHealth = GetComponent<EnemyHealth>(); anim = GetComponent <Animator> (); }
void Awake () { player = GameObject.FindGameObjectWithTag ("Player"); playerHealth = player.GetComponent <PlayerHealth> (); megaHellephantHealth = GetComponent<MegaHellephantHealth>(); anim = GetComponent <Animator> (); }
// Start is called before the first frame update void Awake() { levelBlocks = new LevelBlock[row * col]; for (int i = 0; i < row; i++) { for (int t = 0; t < col; t++) { int idx = i * col + t; Vector3 pos = new Vector3(t * 2, 0, i * 2); levelBlocks[idx] = new LevelBlock(i, t, pos); NavMeshHit hit; if (NavMesh.SamplePosition(pos, out hit, 0.2f, NavMesh.AllAreas)) { //levelBlocks[idx].pos = hit.position; levelBlocks[idx].isOnNavMesh = true; blocksOnMesh.Add(levelBlocks[idx]); } else { levelBlocks[idx].isOnNavMesh = false; } } } InitThreatScore(); SpawnHealth(); playerHealth = GetComponent <CompleteProject.PlayerHealth>(); }
[MenuItem("CONTEXT/PlayerHealth/InitHealthAndSpeed")] //(脚本右键) public static void InitHealthAndSpeed(MenuCommand cmd) //当前正在操作的组件 { Debug.Log(cmd.context.name); CompleteProject.PlayerHealth ph = cmd.context as CompleteProject.PlayerHealth; //修改值 Debug.Log("111111"); }
void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag ("Player"); playerHealth = player.GetComponent <PlayerHealth> (); enemyHealth = GetComponent<EnemyHealth>(); anim = GetComponent <Animator> (); }
[MenuItem("CONTEXT/PlayerHealth/InitHealthAndSpeed")] // CONTEXT 组件名 按钮名 static void InitHealthAndSpeed(MenuCommand cmd) //menucommand是当前正在操作的组件 { //Debug.Log(cmd.context.GetType().FullName); CompleteProject.PlayerHealth health = cmd.context as CompleteProject.PlayerHealth; health.startingHealth = 200; health.flashSpeed = 10; Debug.Log("Init"); }
PlayerHealth playerHealth; // Reference to the player's health. #endregion Fields #region Methods void Awake() { // Set up the references. player = GameObject.FindGameObjectWithTag ("Player").transform; playerHealth = player.GetComponent <PlayerHealth> (); enemyHealth = GetComponent <EnemyHealth> (); nav = GetComponent <NavMeshAgent> (); }
void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag ("Player"); audioSource = GetComponent <AudioSource> (); playerHealth = player.GetComponent <PlayerHealth> (); playerLevel = player.GetComponent <PlayerLevel> (); }
void Awake () { player = GameObject.FindGameObjectWithTag ("Player").transform; playerHealth = player.GetComponent <PlayerHealth> (); megaHellephantHealth = GetComponent <MegaHellephantHealth> (); megaEllephantAttack = GetComponent<MegaHellephantAttack> (); nav = GetComponent <NavMeshAgent> (); }
private void Awake() { Cursor.visible = false; //마우스 커서가 보이지 않게 함 Cursor.lockState = CursorLockMode.Locked; //마우스 커서를 고정시킴 playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <CompleteProject.PlayerHealth>(); bgm = GameObject.FindGameObjectWithTag("BGMController").GetComponent <BGMController>(); curScene = SceneManager.GetActiveScene().buildIndex; DontDestroyOnLoad(gameObject); }
protected override void OnExecute() { base.OnExecute(); levelScanner = ownerAgent.GetComponent <LevelScanner>(); playerHealth = ownerAgent.GetComponent <CompleteProject.PlayerHealth>(); //EndAction(true); }
static void InitHealthAndSpeed(MenuCommand cmd)//是当前正在操作的组件对象 系统调用不用传 { //输出挂载物体的名字 Debug.Log(cmd.context.name); //()转不行就报错 as 不管是不是空是不是能转类型都不会报错 CompleteProject.PlayerHealth health = (CompleteProject.PlayerHealth)cmd.context; health.startingHealth = 200; health.flashSpeed = 10; }
PlayerHealth playerHealth; // Reference to the player's health. #endregion Fields #region Methods void Awake() { // Set up the references. player = GameObject.FindGameObjectWithTag ("Player").transform; playerHealth = player.GetComponent <PlayerHealth> (); enemyHealth = GetComponent <EnemyHealth> (); nav = GetComponent <NavMeshAgent> (); nav.acceleration = Random.Range (0.5f, 1.0f); //nav.acceleration = 0.5f; //nav.speed = Random.Range (5.0f, 10.0f); }
void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent<PlayerHealth>(); enemyHealth = GetComponent<EnemyHealth>(); anim = GetComponent<Animator>(); enemySight = GetComponent<EnemySight>(); lastPlayerSighting = GameObject.FindGameObjectWithTag("GameController").GetComponent<LastPlayerSighting>(); playerInRange = false; }
private int wayPointIndex; // A counter for the way point array. #endregion Fields #region Methods void Awake() { // Setting up the references. enemySight = GetComponent<EnemySight>(); nav = GetComponent<NavMeshAgent>(); player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = player.GetComponent<PlayerHealth>(); enemyHealth = GetComponent<EnemyHealth>(); lastPlayerSighting = GameObject.FindGameObjectWithTag("GameController").GetComponent<LastPlayerSighting>(); wayPointIndex = 0; onHpRegen = false; }
void Awake() { #if !MOBILE_INPUT // Create a layer mask for the floor layer. floorMask = LayerMask.GetMask ("Floor"); #endif // Set up references. anim = GetComponent <Animator> (); playerRigidbody = GetComponent <Rigidbody> (); speed = 5; ph = GetComponent<PlayerHealth>(); }
public static void InithealthAndSpeed(MenuCommand mcd) { //MenuCommand mcd中的context 是当前操作的组件对象 是一个Component CompleteProject.PlayerHealth ph = mcd.context as CompleteProject.PlayerHealth; if (ph != null) { ph.startingHealth = 150; ph.flashSpeed = 20; } Debug.Log("初始化人物属性"); }
public void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player") { playerHealth = collision.gameObject.GetComponent <CompleteProject.PlayerHealth>(); // If the player has health to lose... if (playerHealth.currentHealth > 0) { // ... damage the player. playerHealth.TakeDamage(damage); } } }
private Vector3 previousSighting; // Where the player was sighted last frame. #endregion Fields #region Methods void Awake() { // Setting up the references. nav = GetComponent<NavMeshAgent>(); col = GetComponent<SphereCollider>(); anim = GetComponent<Animator>(); lastPlayerSighting = GameObject.FindGameObjectWithTag("GameController").GetComponent<LastPlayerSighting>(); player = GameObject.FindGameObjectWithTag("Player"); playerAnim = player.GetComponent<Animator>(); playerHealth = player.GetComponent<PlayerHealth>(); //hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>(); // Set the personal sighting and the previous sighting to the reset position. personalLastSighting = lastPlayerSighting.resetPosition; previousSighting = lastPlayerSighting.resetPosition; playerInAttackedRange = false; }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); hp = player.GetComponent <CompleteProject.PlayerHealth>(); serumUI = GameObject.FindGameObjectWithTag("SerumUI"); serum_count = serumUI.GetComponent <CompleteProject.SerumUITutorial>(); serums = GameObject.FindGameObjectWithTag("Serum"); Create_Zombie.SetActive(false); soundController = GameObject.FindGameObjectWithTag("SoundController"); audio = soundController.GetComponent <SoundController>(); bgmController = GameObject.FindGameObjectWithTag("BGMController"); bgm = bgmController.GetComponent <BGMController>(); audio.StartAlarm(); bgm.day(); //BGM출력 DayTimeUI.SetActive(true); //안내메시지 출력 Time.timeScale = 0f; Cursor.visible = true; Cursor.lockState = CursorLockMode.None; }
// Use this for initialization void Start() { shootingScript = GetComponentInChildren <CompleteProject.PlayerShooting>(); playerHealth = gameObject.GetComponent <CompleteProject.PlayerHealth>(); /*if(shootingScript.vrGun != null) * { * // Callback for Local layer, not server * shootingScript.vrGun.OnDown += CmdShoot; * }*/ if (VRTracker.instance != null) { vrGun = VRTracker.instance.getTag(VRTracker.TagType.Gun); } if (vrGun != null) { vrGun.OnDown += FireShot; } }
void OnTriggerEnter(Collider c) { if (c.CompareTag("Player") == false) { return; } CompleteProject.PlayerHealth health = c.GetComponent <CompleteProject.PlayerHealth>(); int hp = health.currentHealth; hp += healAmount; if (hp > 100) { hp = 100; } health.currentHealth = hp; GameObject.Destroy(this.gameObject); }
void Awake() { Enemy_s = Enemy_State.Idle; // 쉬는상태 this_trs = this.transform; Attack = false; // Set up the references. player = GameObject.Find("Player").transform; playerHealth = player.GetComponent <PlayerHealth> (); enemyHealth = GetComponent <EnemyHealth> (); nav = GetComponent <NavMeshAgent> (); nav.autoBraking = true; nav.autoRepath = true; temp_Vector = this_trs.position; Move_cnt = 0; speed = nav.speed; switch (this.gameObject.name) { case "ZomBunny(Clone)": Range = 6; break; case "ZomBear(Clone)": Range = 8; break; case "Hellephant(Clone)": Range = 10; break; case "FirstAid(Clone)": Range = 0; break; } }
void Awake() { // Setting up the references. anim = GetComponent <Animator> (); enemyAudio = GetComponent <AudioSource> (); hitParticles = GetComponentInChildren <ParticleSystem> (); capsuleCollider = GetComponent <CapsuleCollider> (); // Setting the current health when the enemy first spawns. currentHealth = startingHealth; player = GameObject.FindGameObjectWithTag ("Player").transform; playerHealth = player.GetComponent <PlayerHealth> (); }
// Use this for initialization void Start() { respawnPoint = GameObject.FindGameObjectsWithTag("SpawnPoint")[0]; myHead = transform.Find("Player"); playerHealth = GetComponent <CompleteProject.PlayerHealth>(); }
void Awake () { player = GameObject.FindGameObjectWithTag ("Player"); shield = player.transform.Find ("Shield"); playerHealth = player.GetComponent<PlayerHealth> (); }
private void Start() { playerHealth = CompleteProject.PlayerHealth.instance; }
static void 初始化人物(MenuCommand command) //MenuCommand 正在操作的组件对象类 { CompleteProject.PlayerHealth player = (CompleteProject.PlayerHealth)command.context; //声明一个PlayerHealt对象 th —— 正在操作的组件,需要强转为 PlayerHealth类型 Undo.RecordObject(player, "PlayerTools_player"); //记录对象 player 之后的数据变化,用于回退 —— 记录对象(对象,键);//键的名字随意,不能重复 player.startingHealth = 100; //血量初始化到100 }
// True when the player gets damaged void Awake() { // Setting up the references. //animator = GetComponent <Animator> (); playerAudio = GetComponent <AudioSource> (); playerHealth = GetComponent <PlayerHealth> (); //playerKick = GetComponent <PlayerMovement> (); //thirdPersonCharacter = GetComponent <ThirdPersonCharacter> (); playerPunch = GetComponentInChildren<PlayerPunch> (); playerKick = GetComponentInChildren <PlayerKick> (); //levelUpParticles = GetComponentInChildren <ParticleSystem> (); // Set the initial health of the player. currentLevel = startingLevel; expSlider.minValue = startingExp; currentExp = expSlider.minValue; }
// Use this for initialization void Start() { healingParticle = GetComponent<ParticleSystem> (); playerhealth = GetComponent<PlayerHealth> (); }
// Use this for initialization void Start() { this.playerHealth = this.GetComponentInChildren<CompleteProject.PlayerHealth>() as CompleteProject.PlayerHealth; this.playerMovement = this.GetComponentInChildren<CompleteProject.PlayerMovement>() as CompleteProject.PlayerMovement; this.playerShooting = this.GetComponentInChildren<CompleteProject.PlayerShooting>() as CompleteProject.PlayerShooting; }
/** * Loads and caches needed components on start up */ private void Start() { var player = GameObject.FindGameObjectWithTag("Player"); SaveGameManager.playerHealth = player.GetComponent<PlayerHealth>(); SaveGameManager.playerTransform = player.GetComponent<Transform>(); }
// Use this for initialization void Start() { this.playerHealth = this.GetComponentInChildren <CompleteProject.PlayerHealth>() as CompleteProject.PlayerHealth; this.playerMovement = this.GetComponentInChildren <CompleteProject.PlayerMovement>() as CompleteProject.PlayerMovement; this.playerShooting = this.GetComponentInChildren <CompleteProject.PlayerShooting>() as CompleteProject.PlayerShooting; }
// Use this for initialization void Start() { SceneManager.sceneLoaded += OnLevelFinishedLoading; myHead = transform.Find("PlayerHead"); playerHealth = GetComponent <CompleteProject.PlayerHealth>(); }
void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; playerHealth = player.GetComponent<PlayerHealth>(); enemyHealth = GetComponent<EnemyHealth>(); nav = GetComponent<NavMeshAgent>(); isMoving = false; footStepsAudio = FMOD_StudioSystem.instance.GetEvent(audioPath); enemyManagers = GameObject.Find("/EnemyManager").GetComponents<EnemyManager>(); }
PlayerHealth playerHealth; // Reference to the player's health. #endregion Fields #region Methods void Awake() { // Setting up the references. playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerHealth>(); }
void Awake() { player = GameObject.FindGameObjectWithTag ("Player"); playerhealth = player.GetComponent<PlayerHealth>(); }
void Start() { zombie = GameObject.FindGameObjectWithTag("Zombie"); player = GameObject.FindGameObjectWithTag("Player"); hp = player.GetComponent <CompleteProject.PlayerHealth>(); }