// Use this for initialization
	void Start () {
		Initialize ();
		Joystick = g_Joystick.GetComponent<UIJoystick> ();
		AttackButton = g_AttackButton.GetComponent<UIJoystick> ();
		GuardButton = g_GuardButton.GetComponent<UIJoystick> ();
		JumpButton = g_JumpButton.GetComponent<UIJoystick> ();
	}
Example #2
0
        protected override void BuidUI()
        {
            m_txtFps = this.MainGO.FindChildComponentRecursive <Text>("txtFps");
            RectTransform rectTrans = this.MainGO.FindChildComponentRecursive <RectTransform>("JoystickRect");

            m_cBaseTrans    = this.MainGO.FindChildComponentRecursive <RectTransform>("JoystickBase");
            m_cMoveTrans    = this.MainGO.FindChildComponentRecursive <RectTransform>("JoystickMove");
            m_cBtnSkillTest = this.MainGO.FindChildRecursive("btnSkillTest");
            GameObject joystickGO = this.MainGO.FindChildRecursive("Joystick");

            m_cJoystick = joystickGO.AddComponentOnce <UIJoystick>();
            m_cJoystick.Init(rectTrans, m_cBaseTrans, m_cMoveTrans, m_cBaseTrans.rect.width / 2f, true);
            minDirLen            = m_cBaseTrans.rect.width * 0.1f;
            m_cJoystick.OnBegin += OnJoystickBegin;
            m_cJoystick.OnMove  += OnJoystickMove;
            m_cJoystick.OnEnd   += OnJoystickEnd;
            m_cJoystick.AddKeyCode(KeyCode.A, Vector2.left);
            m_cJoystick.AddKeyCode(KeyCode.D, Vector2.right);
            m_cJoystick.AddKeyCode(KeyCode.W, Vector2.up);
            m_cJoystick.AddKeyCode(KeyCode.S, Vector2.down);
            //m_cJoystick.enabled = false;
            SetJoystickActive(false);

            UIEventTrigger.Get(m_cBtnSkillTest).AddListener(EventTriggerType.PointerClick, OnClick);

            //TouchDispatcher.instance.touchBeganListeners += OnTouch;
        }
Example #3
0
 // Use this for initialization
 void Start()
 {
     isShaking = false;
     camera    = GetComponent <Camera> ();
     camera.transform.position = new Vector3(player.transform.position.x, player.transform.position.y, camera.transform.position.z);
     rightJoystick             = GameObject.Find("Right Joystick").GetComponent <UIJoystick> ();
 }
 // Use this for initialization
 void Start()
 {
     Initialize();
     Joystick     = g_Joystick.GetComponent <UIJoystick> ();
     AttackButton = g_AttackButton.GetComponent <UIJoystick> ();
     GuardButton  = g_GuardButton.GetComponent <UIJoystick> ();
     JumpButton   = g_JumpButton.GetComponent <UIJoystick> ();
 }
Example #5
0
	void Start()
	{
		// bottom, left quadrant of screen
		leftJoystick = UIJoystick.create( "joystickUp.png", new Rect( 0, Screen.height / 2, Screen.width / 2, 200 ), Screen.width / 4, -150 / 2 );
		leftJoystick.deadZone = new Vector2( 0.6f, 0.6f );
		leftJoystick.setJoystickHighlightedFilename( "joystickDown.png" );


		// bottom, right quadrant of screen
		rightJoystick = UIJoystick.create( "joystickUp.png", new Rect( Screen.width / 2, Screen.height / 2, Screen.width / 2, 200 ), Screen.width / 4, -150 / 2 );
		rightJoystick.deadZone = new Vector2( 0.5f, 0.5f );
		rightJoystick.setJoystickHighlightedFilename( "joystickDown.png" );	
		rightJoystick.addBackgroundSprite( "joystickTrack.png" );
	}
Example #6
0
    void Start()
    {
        // bottom, left quadrant of screen
        leftJoystick          = UIJoystick.create("joystickUp.png", new Rect(0, Screen.height / 2, Screen.width / 2, 200), Screen.width / 4, -150 / 2);
        leftJoystick.deadZone = new Vector2(0.6f, 0.6f);
        leftJoystick.setJoystickHighlightedFilename("joystickDown.png");


        // bottom, right quadrant of screen
        rightJoystick          = UIJoystick.create("joystickUp.png", new Rect(Screen.width / 2, Screen.height / 2, Screen.width / 2, 200), Screen.width / 4, -150 / 2);
        rightJoystick.deadZone = new Vector2(0.5f, 0.5f);
        rightJoystick.setJoystickHighlightedFilename("joystickDown.png");
        rightJoystick.addBackgroundSprite("joystickTrack.png");
    }
Example #7
0
    public void PlayerInit(GameObject Ultimate)
    {
        GameObject UI = GameObject.Find("GameUI");
        GameObject playerUI = UI.transform.GetChild(6).gameObject;
        for (int i = 1; i < 4; i++)
        {
            m_ListKey.Add(playerUI.transform.GetChild(i).gameObject);
        }

        m_fMaxHP = float.Parse(UserInfo.instance.GetCharData(CHAR_DATA.CHAR_MAX_HP, m_iIndex).ToString());
        m_fCurHP = m_fMaxHP;

        m_fMaxSP = float.Parse(UserInfo.instance.GetCharData(CHAR_DATA.CHAR_MAX_SP, m_iIndex).ToString());
        m_fCurSP = m_fMaxSP;

        m_Input = playerUI.GetComponentInChildren<UIJoystick>();
        //초기 셋팅

        string strExcel = "Excel/CharacterExcel/" + Util.ConvertToString(m_iIndex) + "_KeyControl";
        var Key = EXCEL.ExcelLoad.Read(strExcel);
        string[] KeyList = Key[0]["Key"].ToString().Split('/');
        KeyList = KeyList[0].Split(';');

        m_UltimateSkill.st_iKey = (KEY_TYPE)Util.ConvertToInt(KeyList[0]);
        m_UltimateSkill.st_eInput = (KEY_INPUT)Util.ConvertToInt(KeyList[1]);
        m_UltimateSkill.st_iSpendSP = Util.ConvertToInt(KeyList[2]);
        //키, 입력 타입, 소모값

        for (int i = 1; i < Key.Count; i++)
        {
            string index = Key[i]["Index"].ToString();
            KeyList = Key[i]["Key"].ToString().Split('/');
            
            List<st_Key> ListNode = new List<st_Key>();
            for (int j = 0; j < KeyList.Length; j++)
            {
                st_Key Node = new st_Key();
                string [] NodeKey = KeyList[j].Split(';');
    
                Node.st_iIndex = j;
                Node.st_iKey = (KEY_TYPE)Util.ConvertToInt(NodeKey[0]);
                Node.st_eInput = (KEY_INPUT)Util.ConvertToInt(NodeKey[1]);
                ListNode.Add(Node);
            }
            m_ListComboKey.Add(ListNode);
        }
        //여기서 플레이어 키 셋팅
        m_UltimateEffect = Ultimate;
    }
Example #8
0
 void Start()
 {
     joystick = UIJoystick.create("button_control.png", joystickTouchFrame, 120, -280);
     joystick.position = new Vector3(joystick.position.x, joystick.position.y, 10);
     joystick.maxJoystickMovement = 60;
  
     int x, y;
  
     x = Screen.width - 180;
     y = Screen.height - 180;
     missileButton = UIContinuousButton.create("button_missile.png", "button_missile.png", x, y);
     missileButton.normalTouchOffsets = new UIEdgeOffsets(20, 20, 5, 20);
     missileButton.highlightedTouchOffsets = new UIEdgeOffsets(20, 20, 5, 20);
     missileButton.onTouchIsDown += MissileButtonIsDown;
 }
		public override void OnEnter()
		{
			var go = Fsm.GetOwnerDefaultTarget(gameObject);
			if (go == null)
			{
				return;
			}

			_joystick = go.GetComponent<UIJoystick>();

			if (_joystick == null)
			{
				return;
			}
			
			doGetPadInputs();
			
			if (!everyFrame)
				Finish();		
		}
        public override void OnEnter()
        {
            var go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                return;
            }

            _joystick = go.GetComponent <UIJoystick>();

            if (_joystick == null)
            {
                return;
            }

            doGetPadInputs();

            if (!everyFrame)
            {
                Finish();
            }
        }
Example #11
0
 private void Start()
 {
     instance = this;
 }
    void Awake()
    {
        motor.movementDirection = Vector2.zero;
        motor.facingDirection = Vector2.zero;

        // Set main camera
        mainCamera = Camera.main;
        mainCameraTransform = mainCamera.transform;

        // Ensure we have character set
        // Default to using the transform this component is on
        if (!character)
        character = transform;

        initOffsetToPlayer = mainCameraTransform.position - character.position;

        #if UNITY_IPHONE || UNITY_ANDROID
        if (joystickPrefab) {
            // Create left joystick
            //joystickLeftGO = Instantiate (joystickPrefab) as GameObject;
            joystickLeftGO.SetActiveRecursively(true);
            joystickLeftGO.name = "Joystick Left";
            joystickLeft = joystickLeftGO.GetComponent<UIJoystick> ();

            // Create right joystick
            //joystickRightGO = Instantiate (joystickPrefab) as GameObject;
            joystickRightGO.SetActiveRecursively(true);
            joystickRightGO.name = "Joystick Right";
            joystickRight = joystickRightGO.GetComponent<UIJoystick> ();

            /*
            joystickLeftGOGUITexture = joystickLeftGO.GetComponent<GUITexture>();
            joystickRightGOGUITexture = joystickRightGO.GetComponent<GUITexture>();

            gesturesLockLeftTexture.transform.parent = joystickLeftGO.transform;
            gesturesLockRightTexture.transform.parent = joystickRightGO.transform;

            gesturesLockLeftTextureGUITexture = gesturesLockLeftTexture.GetComponent<GUITexture>();
            gesturesLockRightTextureGUITexture = gesturesLockRightTexture.GetComponent<GUITexture>();
             */

            /*
            gesturesLockLeftTextureGUITexture.pixelInset.width = 190;
            gesturesLockLeftTextureGUITexture.pixelInset.height = 160;

            gesturesLockRightTextureGUITexture.pixelInset.width = 190;
            gesturesLockRightTextureGUITexture.pixelInset.height = 160;
            */
            /*
            gesturesLockLeftTextureGUITexture.pixelInset.width = Screen.width * 0.4f;
            gesturesLockLeftTextureGUITexture.pixelInset.height = Screen.height * 0.45f;

            gesturesLockRightTextureGUITexture.pixelInset.width = Screen.width * 0.4f;
            gesturesLockRightTextureGUITexture.pixelInset.height = Screen.height * 0.45f;
            */
        }
        #else
        if (cursorPrefab) {
            cursorObject = (Instantiate (cursorPrefab) as GameObject).transform;
        }
        #endif

        // Save camera offset so we can use it in the first frame
        cameraOffset = mainCameraTransform.position - character.position;

        // Set the initial cursor position to the center of the screen
        cursorScreenPosition = new Vector3 (0.5f * Screen.width, 0.5f * Screen.height, 0.0f);

        // caching movement plane
        playerMovementPlane = new Plane (character.up, character.position + character.up * cursorPlaneHeight);
    }
Example #13
0
 private void Start()
 {
     instance = this;
 }
Example #14
0
 void Start()
 {
     Joystick = transform.Find("Container/Joystick").GetComponent<UIJoystick>();
     Offset = transform.Find("Container/Offset").GetComponent<UILabel>();
 }
Example #15
0
    void Start()
    {
        text        = new UIText(textToolkit, "GhoulishFont", "GhoulishFont_0.png");
        startScript = FindObjectOfType(typeof(StartScript)) as StartScript;
        loader      = FindObjectOfType(typeof(loadingScript)) as loadingScript;
        character   = FindObjectOfType(typeof(CharacterMaster)) as CharacterMaster;
        //DontDestroyOnLoad(this.gameObject);



        AmmoText     = text.addTextInstance("Bullets: " + startScript.Ammunition.ToString(), 0, 0, textScaleFactor, 2, Color.white, UITextAlignMode.Left, UITextVerticalAlignMode.Middle);
        PickupAmount = text.addTextInstance("+20", 0, 0, textScaleFactor * 5, 2, Color.white, UITextAlignMode.Left, UITextVerticalAlignMode.Middle);
        PickupAmount.alphaTo(0.1f, 0, Easing.Quartic.easeIn);
        PickupAmount.hidden = true;

        LevelInstruc = text.addTextInstance("" + LvlInstructions, 0, 0, textScaleFactor, 2, Color.white, UITextAlignMode.Center, UITextVerticalAlignMode.Middle);
        LevelInstruc.positionCenter();
        LevelInstruc.alphaTo(0.01f, 0, Easing.Quartic.easeIn);

        StartCoroutine(StartLvlInstruction());
        // buttons ------------------------------------


        PauseBtn = UIButton.create(buttonUI, "PauseBtn.png", "PauseBtn.png", 0, 0, 10);
        PauseBtn.positionFromTopLeft(0.035f, 0.045f);
        PauseBtn.onTouchUpInside += onTouchPauseBtn;
        PauseBtn.touchDownSound   = buttonSound;
        PauseBtn.hidden           = false;

        PlayBtn = UIButton.create(buttonUI, "PlayBtn.png", "PlayBtn.png", 0, 0, 10);
        PlayBtn.positionFromCenter(0.2f, -0.21f);
        PlayBtn.onTouchUpInside += onTouchPlayBtn;
        PlayBtn.touchDownSound   = buttonSound;
        PlayBtn.hidden           = true;

        RetryBtn = UIButton.create(buttonUI, "RetryBtn.png", "RetryBtn.png", 0, 0, 10);
        RetryBtn.positionFromCenter(0.2f, -0.07f);
        RetryBtn.onTouchUpInside += onTouchRetryBtn;
        RetryBtn.touchDownSound   = buttonSound;
        RetryBtn.hidden           = true;

        QuitBtn = UIButton.create(buttonUI, "QuitBtn.png", "QuitBtn.png", 0, 0, 10);
        QuitBtn.positionFromCenter(0.2f, 0.07f);
        QuitBtn.onTouchUpInside += onTouchQuitBtn;
        QuitBtn.touchDownSound   = buttonSound;
        QuitBtn.hidden           = true;

        //------TOGGLE BTNS-------------------------------


        AudioBtn = UIToggleButton.create(buttonUI, "AudioOffBtn.png", "AudioBtn.png", "AudioOffBtn.png", 0, 0, 10);
        AudioBtn.positionFromCenter(0.2f, 0.21f);
        AudioBtn.onToggle += onTouchAudioBtn;
        AudioBtn.hidden    = true;
        if (PlayerPrefs.GetInt("volume") == 1)
        {
            AudioBtn.selected = true;
        }

        //-------------------HEALTH METER--------------------------------------


        HealthBG = buttonUI.addSprite("HealthBG.png", 0, 0, 10);
        HealthBG.positionFromCenter(-0.41f, 0.0f);


        HealthBar = UIProgressBar.create(buttonUI, "HealthBar.png", 0, 0, false, 5, false);
        Vector2 tempVec;

        tempVec            = new Vector2(HealthBG.position.x + 95, HealthBG.position.y - 10);
        HealthBar.position = tempVec;

        HealthBar.value = 1;


        //----------------------PICKUPS-------------------------



        HealthPickup = buttonUI.addSprite("HeartPickup.png", 0, 0, 10);
        HealthPickup.positionFromCenter(-0.0f, 0.0f);
        HealthPickup.alphaTo(0.1f, 0, Easing.Quartic.easeIn);
        HealthPickup.hidden = true;

        AmmoPickup = buttonUI.addSprite("AmmoPickup.png", 0, 0, 10);
        AmmoPickup.positionFromCenter(-0.0f, 0.0f);
        AmmoPickup.alphaTo(0.1f, 0, Easing.Quartic.easeIn);
        AmmoPickup.hidden = true;


        //-----------------------------CONTROLS------------------------------------------


        LToggle          = UIJoystick.create(buttonUI, "LToggle.png", new Rect(Screen.width * 0.01f, Screen.height * 0.45f, Screen.width * 0.4f, Screen.height * 0.6f), Screen.width * 0.175f, Screen.height * -0.3f);
        LToggle.deadZone = new Vector2(0.8f, 0.8f);
        //LToggle.setJoystickHighlightedFilename( "LToggleT.png" );
        AttackBtn = UIContinuousButton.create("AttackBtn.png", "AttackBtn.png", 0, 0);
        AttackBtn.positionFromBottomRight(0.05f, 0.05f);
        AttackBtn.centerize();         // centerize the button so we can scale it from the center
        AttackBtn.highlightedTouchOffsets = new UIEdgeOffsets(30);
        AttackBtn.onTouchIsDown          += onTouchAttackBtn;
        AttackBtn.onTouchUpInside        += onTouchAttackBtnUp;



        if (loader != null)
        {
            if (loader.ControllerCount > 0)
            {
                LToggle.hidden   = true;
                AttackBtn.hidden = true;
            }
        }
    }
Example #16
0
    void Start()
    {
        ActionController = GameObject.FindGameObjectWithTag("Player").GetComponent <AudioSource>();
        Hpba             = GameObject.Find("HpbaBg").GetComponent <UIProgressBar>();
        boast            = GameObject.Find("BoastingBg").GetComponent <UIProgressBar>();
        Fireicon         = GameObject.Find("Fireicon").GetComponent <UISprite>();
        PosionIcon       = GameObject.Find("Posionicon").GetComponent <UISprite>();
        Slowicon         = GameObject.Find("Slowicon").GetComponent <UISprite>();
        win              = GameObject.Find("Win Label").GetComponent <UILabel>();
        Lose             = GameObject.Find("Lose Label").GetComponent <UILabel>();
        hitted2          = GameObject.Find("BloodTexture").GetComponent <UITexture>();
        btm              = GameObject.Find("Outbtm").GetComponent <UISprite>();
        btmlabel         = GameObject.Find("OutLabel").GetComponent <UILabel>();
        win.enabled      = false;
        Lose.enabled     = false;
        hitted2.enabled  = false;
        btm.enabled      = false;
        btmlabel.enabled = false;

        GameObject.Find("UiManeger").GetComponent <Btmmanger>().PlayerSound = GameObject.FindGameObjectWithTag("Player").GetComponent <AudioSource>();
        //ActionController = GameObject.FindGameObjectWithTag("Player").GetComponent<AudioSource>();
        BgmManmeger.Instance.ActionController = GameObject.FindGameObjectWithTag("Player").GetComponent <AudioSource>();
        v                        = transform.forward;
        AniControll              = GetComponent <Animator>();
        basespd                  = spd;
        iv                       = GetComponentInChildren <Inventory>();
        iv.p                     = this;
        frontweaponbtn           = GameObject.Find("Frontweapon").GetComponent <UIButton>();
        backweaponbtn            = GameObject.Find("Backweapon").GetComponent <UIButton>();
        pickbtn                  = GameObject.Find("Pickupbtn").GetComponent <UIButton>();
        firebtn                  = GameObject.Find("Firebtn").GetComponent <UIEventTrigger>();
        stick                    = GameObject.Find("handle").GetComponent <UIJoystick>();
        stick.pl                 = this;
        pv                       = GetComponent <PhotonView>();
        t                        = GetComponent <Transform>();
        pv.ObservedComponents[0] = this;
        //카메라 할당
        if (pv.isMine)
        {
            GameObject.Find("Main Camera").GetComponent <SmoothFollow>().target = t;
            gameObject.tag = "Player";
        }
        else
        {
            GetComponent <AudioListener>().enabled = false;
            gameObject.tag = "Enemy";
            a.tag          = "a";
            b.tag          = "a";
        }
        //버튼 동적 할당
        fireon  = new EventDelegate(this, "Firebtnon");
        fireoff = new EventDelegate(this, "Firebtnoff");
        firebtn.onPress.Add(fireon);
        firebtn.onRelease.Add(fireoff);
        picking = new EventDelegate(this, "Pickupitem");
        pickbtn.onClick.Add(picking);
        cngbw = new EventDelegate(this, "Backweapon");
        backweaponbtn.onClick.Add(cngbw);
        cngfw = new EventDelegate(this, "Frontweapon");
        frontweaponbtn.onClick.Add(cngfw);
    }