示例#1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
示例#2
0
 private void InitializeSingleton()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(this);
     }
 }
示例#3
0
 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();
 }
示例#4
0
    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());
    }
示例#5
0
    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;
    }
示例#6
0
 private void Start()
 {
     m_animator   = this.GetComponent <Animator>();
     moveJoystick = GameObject.FindGameObjectWithTag("UIMove").GetComponent <MoveJoystick>();
 }
示例#7
0
 protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     base.OnNavigatingFrom(e);
     MoveJoystick.StopJoystick();
     ViewModel.AccelMovement.EnsureAccelerometerIsOnCommand.Execute(false);
 }
示例#8
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     MoveJoystick.StartJoystick();
     RefreshVisibilities();
 }
示例#9
0
 public void SetJoystick(MoveJoystick _joystick)
 {
     joystick = _joystick;
 }
示例#10
0
    // 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);
    }