void Awake() { teleport = GameObject.Find("TeleportController").GetComponent <TeleportController>(); sight = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerSight>(); GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>().onGameRestart += Start; }
void Awake() { player = GameObject.FindGameObjectWithTag(Tags.player); playerSight = player.GetComponent <PlayerSight>(); nav = GetComponent <NavMeshAgent>(); zombieAudio = GetComponent <AudioSource>(); }
// Start is called before the first frame update void Start() { target = AssetsManager.Instance.Player.GetComponent <PlayerSight>(); animator = GetComponentInChildren <Animator>(); navAgent = GetComponent <NavMeshAgent>(); navAgent.Warp(transform.position); }
void Awake() { GameObject enemy = GameObject.FindGameObjectWithTag("Enemy"); GameObject playerObj = GameObject.FindGameObjectWithTag("Player"); villain = enemy.transform; villainAI = enemy.GetComponent <VillainAI>(); player = playerObj.transform; sight = playerObj.GetComponent <PlayerSight>(); villainNav = villain.gameObject.GetComponent <NavMeshAgent>(); }
public override void Start() { base.Start(); if (gm.IsPvp) { nm = NetworkManager.Instance; } sr = GetComponent <SpriteRenderer>(); healthBar.Initialize(); staminaBar.Initialize(); boxCol = GetComponent <BoxCollider2D>(); sight = GetComponentInChildren <PlayerSight>(); myVoice = GetComponent <AudioSource>(); Dead += (() => MyAnimator.SetTrigger("Dead")); Dead += (() => boxCol.enabled = false); }
void OnCollisionEnter(Collision col) { if (col.gameObject.GetComponent <Rigidbody>() != null) { float kineticColDamage = KineticEnergy(col.gameObject.GetComponent <Rigidbody>()); print("KCE is " + kineticColDamage); if (col.gameObject.GetComponent <EntityHealth>() != null) { if (kineticColDamage > damageThreshold) { entityCurrentHealth = entityCurrentHealth - (Mathf.RoundToInt(kineticColDamage - damageThreshold)); } } else if (this.gameObject.GetComponent <EntityHealth>() != null) { if (isPlayer && PlayerSight.playerHoldingPosition.childCount > 0) { if (kineticColDamage > damageThreshold) { print(" Player hit col object " + col.gameObject.name + " too hard for " + kineticColDamage + " vs " + damageThreshold + " has a rb"); PlayerSight.DropObject(PlayerSight.hit.transform.gameObject); } } } } float kineticDamage = KineticEnergy(this.transform.GetComponent <Rigidbody>()); print("KE is " + kineticDamage); if (kineticDamage > damageThreshold) { if (!isPlayer) { entityCurrentHealth = entityCurrentHealth - (Mathf.RoundToInt(kineticDamage - damageThreshold)); } else if (isPlayer && PlayerSight.playerHoldingPosition.childCount > 0) { print(" Player hit the ground too hard for " + kineticDamage + " vs " + damageThreshold + " has a rb"); PlayerSight.DropObject(PlayerSight.hit.transform.gameObject); } } }
void Start() { _spawns.AddRange(GameObject.FindGameObjectsWithTag("Spawn Point")); _dayCycle = GameObject.Find("MainLight").GetComponent <DayCycle>(); _clock = GameObject.Find("Clock"); _dayCounter = transform.FindChild("DayCounter").GetComponent <Text>(); StartCoroutine(Timer()); _towns.AddRange(GameObject.FindGameObjectsWithTag("Town")); _rumourScript = GameObject.Find("TownCanvas").GetComponent <RumourGenerator>(); _playerSight = GameObject.Find("SightRadius").GetComponent <PlayerSight>(); UpdateClock(); Time.timeScale = 1.0f; _saveGame = GameObject.Find("Loader").GetComponent <SaveGame>(); GenerateEnemies(); if (_saveGame._skipDay) { Sleep(); } _saveGame._skipDay = false; }
// Use this for initialization void Start() { navMesh = gameObject.GetComponent <NavMeshAgent>(); playerSight = gameObject.GetComponentInChildren <PlayerSight>(); }
void Awake () { teleport = GameObject.Find("TeleportController").GetComponent<TeleportController>(); sight = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerSight>(); GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>().onGameRestart += Start; }
void Awake() { player = GameObject.FindGameObjectWithTag(Tags.player); playerSight = player.GetComponent <PlayerSight>(); Debug.Log(playerSight); }
public void Start() { playerSight = GetComponentInChildren <PlayerSight>(); }