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() { pm = GetComponent <PlayerMovement>(); pg = GetComponent <PlayerGrenade>(); sellingUIOn = false; canOpenUI = false; Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; sellingUI.SetActive(false); sellingOpenUI.SetActive(false); }
// Use this for initialization void Start() { //setup any variables/references we will need at the start of the game hitMarker.SetActive(false); torsoMarker.SetActive(false); pickupPrompt.SetActive(false); reloadPrompt.SetActive(false); anim.SetBool("Scoped", false); grenades = FindObjectOfType <GrenadeAmmo>(); player = GetComponent <PlayerController2>(); motor = GetComponent <PlayerMotor>(); //we tell Unity to grab the PlayerMotor script component attached to this object, and call it 'motor'. Now Unity knows what we mean when we say 'motor' later o shoot = GetComponent <PlayerShoot2>(); //we tell Unity to grab the PlayerShoot script component attached to this object, and call it 'shoot.' Now Unity knows what we mean when we say 'shoot' later on spawnEnemy = GetComponent <SpawnEnemy>(); //ref to spawn enemy through the other script grenade = GetComponent <PlayerGrenade>(); //we tell Unity to grab the PlayerGrenade script component attached to this object, and call it 'grenade.' Now Unity knows what we mean when we say 'grenade' later on }
// Start is called before the first frame update void Start() { pg = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerGrenade>(); }