private Animator anim; // Reference to the Animator on the player void Awake() { // Setting up references. playerControl = GetComponent <playerControllerScript>(); //healthBar = GameObject.Find("HealthBar").GetComponent<SpriteRenderer>(); anim = GetComponent <Animator>(); }
// Use this for initialization void Start() { currentHealth = fullHealth; healthSlider.fillAmount = 0f; controlMovement = GetComponent <playerControllerScript> (); playerAS = GetComponent <AudioSource> (); //rubyCount.text = collectedRubies.ToString(); }
// public GameObject rewardObject; void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { // Instantiate(rewardObject, transform.position, Quaternion.identity); playerControllerScript mySpeed = other.gameObject.GetComponent <playerControllerScript>(); mySpeed.decreaseSpeed(); Destroy(transform.root.gameObject); } }
// Start is called before the first frame update void Start() { shooter = GetComponent <Shooter>(); animator = GetComponent <Animator>(); playerControllerScript = GetComponent <playerControllerScript>(); if (photonView.IsMine) { foreach (GameObject gameObject in FpsGameobjects) { gameObject.SetActive(true); } foreach (GameObject gameObject in soldierGameObjects) { gameObject.SetActive(false); } animator.SetBool("isSoldier", false); GameObject gameObject1 = Instantiate(playerUiPrefab); playerControllerScript.joystick = gameObject1.transform.Find("Fixed Joystick").GetComponent <Joystick>(); playerControllerScript.FixedTouchField = gameObject1.transform.Find("RotateTouchField").GetComponent <FixedTouchField>(); gameObject1.transform.Find("ShootButton").GetComponent <Button>().onClick.AddListener(() => shooter.Fire()); fpsCamera.enabled = true; } else { foreach (GameObject gameObject in FpsGameobjects) { gameObject.SetActive(false); } foreach (GameObject gameObject in soldierGameObjects) { gameObject.SetActive(true); } animator.SetBool("isSoldier", true); playerControllerScript.enabled = false; GetComponent <RigidbodyFirstPersonController>().enabled = false; fpsCamera.enabled = false; } }
// Use this for initialization void Start() { controlMovement = GetComponent <playerControllerScript> (); playerAS = GetComponent <AudioSource> (); rubyCount.text = collectedRubies.ToString(); }