void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); } }
private void InitializeSingleton() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(this); } }
void Start() { highlightPosCube.SetActive(false); moveJoystick = GameObject.FindGameObjectWithTag("UIMove").GetComponent <MoveJoystick>(); baseSkillUI = GameObject.FindGameObjectWithTag("UIBaseSkill"); skill1UI = GameObject.FindGameObjectWithTag("UISkill1"); skill2UI = GameObject.FindGameObjectWithTag("UISkill2"); skill3UI = GameObject.FindGameObjectWithTag("UISkill3"); skill4UI = GameObject.FindGameObjectWithTag("UISkill4"); baseSkillJoystick = GameObject.FindGameObjectWithTag("UIBaseSkill").GetComponent <SkillJoystick>(); LoadUIResources(); }
protected virtual void Start() { moveJoystick = MoveJoystick.Instance; shootJoystick = ShootJoystick.Instance; rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); sr = GetComponent <SpriteRenderer>(); dustParticles = GetComponentInChildren <ParticleSystem>(); dustVelocity = dustParticles.velocityOverLifetime; ultimateAbilityBtn = GameObject.Find("UltimateAbility Button").GetComponent <Button>(); ultimateAbilityBtn.onClick.AddListener(() => UseUltimateAbility()); }
private void Awake() { //boxCollider = GetComponent<BoxCollider2D>(); //spriteRenderer = GetComponent<SpriteRenderer>(); //animator = GetComponent<Animator>(); //PV = GetComponent<PhotonView>(); //rb = GetComponent<Rigidbody2D>(); //playerMovement = GetComponent<PlayerMovement>(); //playerWeaponManager = GetComponent<PlayerWeaponManager>(); moveJoystick = MoveJoystick.Instance; shootJoystick = ShootJoystick.Instance; crosshairManager = CrosshairManager.Instance; changeWeaponBar = ChangeWeaponBar.Instance; player = PhotonNetwork.LocalPlayer; }
private void Start() { m_animator = this.GetComponent <Animator>(); moveJoystick = GameObject.FindGameObjectWithTag("UIMove").GetComponent <MoveJoystick>(); }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); MoveJoystick.StopJoystick(); ViewModel.AccelMovement.EnsureAccelerometerIsOnCommand.Execute(false); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); MoveJoystick.StartJoystick(); RefreshVisibilities(); }
public void SetJoystick(MoveJoystick _joystick) { joystick = _joystick; }
// Use this for initialization void Start() { string username = "******"; if (!isLocalPlayer) { DisableComponents(); AssignRemoteLayer(); } else { // If we have a main camera and it has been marked as main //sceneCamera = Camera.main; if (sceneCamera != null) { //sceneCamera.gameObject.SetActive(false); } playerUIInstance = Instantiate(playerUIPrefab); playerUIInstance.name = playerUIPrefab.name; PlayerUI playerUI = playerUIInstance.GetComponent <PlayerUI>(); // PlayerUI component of the PlayerUI instance EnergyScript energy = this.gameObject.GetComponent <EnergyScript>(); energy.energyBarImage = playerUI.energyBar; energy.chargeBarImage = playerUI.chargeEnergyBar; Health health = this.gameObject.GetComponent <Health>(); health.HealthImage = playerUI.healthBar; // HealthBarManager healthBarManager = GameObject.FindObjectOfType<HealthBarManager>(); ComboMeter combometer = this.gameObject.GetComponent <ComboMeter>(); combometer.ComboCounterText = playerUI.comboCounterText; combometer.ComboTimerBar = playerUI.comboCounterTimer; DragonAttack dragonAttack = this.gameObject.GetComponent <DragonAttack>(); dragonAttack.raycaster = playerUIInstance.GetComponent <GraphicRaycaster>(); Radar radar = this.gameObject.GetComponent <Radar>(); radar = playerUI.radar; MoveJoystick joystick = playerUI.joystick.GetComponent <MoveJoystick>(); this.gameObject.GetComponent <PlayerMovement>().SetJoystick(joystick); bStartTimeCheck = false; } RegisterPlayer(); GetComponent <Player>().Setup(); if (UserAccountManager.IsLoggedIn) { username = UserAccountManager.LoggedIn_Username; } else { username = transform.name; } CmdSetUsername(transform.name, username); }