예제 #1
0
        private void Execute(StateUI stateUI, bool isSave = true)
        {
            if (_currentWindow != null)
            {
                _currentWindow.Cancel();
            }

            switch (stateUI)
            {
            case StateUI.None:
                Debug.Log("Panel None");
                break;

            case StateUI.PanelOne:
                _currentWindow = _panelOne;
                break;

            case StateUI.PanelTwo:
                _currentWindow = _panelTwo;
                break;

            default:
                throw new System.ArgumentNullException("None Panel");
            }

            _currentWindow.Execute();

            if (isSave)
            {
                _stateUIs.Push(stateUI);
            }
        }
예제 #2
0
        private void Execute(StateUI stateUI, bool isSave = true)
        {
            if (_currentWindow != null)
            {
                _currentWindow.Cancel();
            }

            switch (stateUI)
            {
            case StateUI.PanelOne:
                _currentWindow = _panelOne;
                break;

            case StateUI.PanelTwo:
                _currentWindow = _panelTwo;
                break;

            default:
                break;
            }

            _currentWindow.Execute();
            if (isSave)
            {
                _stateUi.Push(stateUI);
            }
        }
	void Awake() {

		m_Button = GetComponent<Button> ();
		m_StateUIPanel = transform.GetComponentInParent<StateUI> ();

		if (m_Button != null) {
			m_Button.onClick.AddListener (OnButtonClick);
		}
	}
 public void ChangeState(StateUI state)
 {
     currentState = state;
     StartCoroutine(state.ToString() + "State");
     if (OnStateChanged != null)
     {
         OnStateChanged.Invoke(this, new EventArgs <int>((int)state));
     }
 }
예제 #5
0
    private void EndScreen()
    {
        Time.timeScale = 1.0f;
        menuState.SetActive(false);
        playState.transform.Find("Canvas").GetComponent <Canvas>().enabled = false;
        endState.SetActive(true);

        curStateUI = endState.GetComponent <StateUI>();
        curStateUI.SetActive();
    }
예제 #6
0
파일: GameMaster.cs 프로젝트: Jurosale/JTM
    // Use this for initialization
    void Start()
    {
        UIObject = GameObject.Find("State UI");
        UI       = UIObject.GetComponent <StateUI>();

        cameraObject = GameObject.Find("Main Camera");
        mainCamera   = cameraObject.GetComponent <MainCamera>();

        speechRecObj = GameObject.Find("SpeechRecognition");
        speech       = speechRecObj.GetComponent <SpeechRecognition01>();
    }
예제 #7
0
    private void Menu()
    {
        menuState = GameObject.Find("MenuState");
        playState = GameObject.Find("PlayState");
        endState  = GameObject.Find("EndState");

        Time.timeScale = 1.0f;
        menuState.SetActive(true);
        //playState.SetActive(false);
        playState.transform.Find("Canvas").GetComponent <Canvas>().enabled = false;
        endState.SetActive(false);

        curStateUI = menuState.GetComponent <StateUI>();
        curStateUI.SetActive();
    }
예제 #8
0
    private void StatusOnClick(GameObject obj)
    {
        //Debug.Log(obj.name);
        StateUI sui = obj.GetComponent <StateUI>();

        if (sui.attacker == null || (!(sui.attacker is HeroAttacker) && sui.attacker.IsDead))
        {
            return;
        }
        Camera.main.GetComponent <FollowTarget>().target = sui.attacker.transform;
        foreach (var item in statusUI)
        {
            item.ShowFocus(false);
        }
        sui.ShowFocus(true);
        tarState.SetAttakcer(sui.attacker.Target);
    }
예제 #9
0
    public void RegStateUI(StateUI ui)
    {
        GameObject button = ui.gameObject;

        UIEventListener.Get(button).onClick = StatusOnClick;
        if (ui.name == "targetStatus")
        {
            tarState = ui;
            return;
        }
        if (ui.name == "heroStatus")
        {
            heroState = ui;
            return;
        }
        this.statusUI.Add(ui);
        this.statusUI.Sort((a, b) => b.transform.position.y.CompareTo(a.transform.position.y));
    }
예제 #10
0
        public void Execute(StateUI stateUI)
        {
            if (CurrentWindow != null)
            {
                CurrentWindow.Cancel();
            }

            if (stateUI == StateUI.None)
            {
                if (StateUIStack.Count == 0)
                {
                    return;
                }
                StateUIStack.Pop();
                if (StateUIStack.Count == 0)
                {
                    return;
                }
                stateUI = StateUIStack.Pop();
            }

            StateUIStack.Push(stateUI);

            switch (stateUI)
            {
            case StateUI.HealthBarUISimple:
                CurrentWindow = _healthBarUISimple;
                CurrentWindow.GetPlayerData(_dataPlayer);
                break;

            case StateUI.HealthBarUIWhisSpacePlane:
                CurrentWindow = _healthBarUIWhisSpacePlane;
                CurrentWindow.GetPlayerData(_dataPlayer);
                break;

            default:
                break;
            }

            CurrentWindow.Execute();
        }
예제 #11
0
    }                               //yohan added


    public virtual void Init()
    {
        // Initialization

        if (gameObject.name == "Player")
        {
            //stats = SaveSystem.LoadStats();
            //stats.maxHP = SaveSystem.LoadStats().maxHP;
            stats = new Stats(initHP, initAtt, initSpeed, initAttSpeed, initDefence, initCriticalChance);
        }
        else
        {
            stats = new Stats(initHP, initAtt, initSpeed, initAttSpeed, initDefence, initCriticalChance);
        }
        InitInput();
        InitInventory();
        movement = GetComponent <IMovement>();
        combat   = GetComponent <ICombat>();
        movement.Init(this);
        combat.Init(this);
        gm = GameObject.FindWithTag("GameController").GetComponent <GameManager>();
        damageTextPrefab = Resources.Load <GameObject>("Prefabs/DamageText");
        dialogTextPrefab = Resources.Load <GameObject>("Prefabs/StateUIs/FloatingDialog");
        GameObject stateUIInstance = Instantiate(stateUIPrefab, Vector3.zero, Quaternion.identity) as GameObject;

        stateUI = stateUIInstance.GetComponentInChildren <StateUI>();
        InitStateUI();

        animationManager = GetComponent <AnimationManager>();
        if (animationManager != null)
        {
            animationManager.Init();
        }
        IsAlive              = true;
        ActivateAutoAim      = true;
        drops                = new Drops(creditDrop, energyDrop);
        gm.WorldColorChange += OnWorldColorChange;
        audioManager         = FindObjectOfType <AudioManager>();
    }
예제 #12
0
    public override void Init()
    {
        base.Init();
        var weaponSocket1 = transform.Find("Hand1");
        var weaponSocket2 = transform.Find("Hand2");

        dualWieldSockets = new Transform[] { weaponSocket1, weaponSocket2 };
        singleSocket     = new Transform[] { weaponSocket2 };
        singleSocket2    = new Transform[] { weaponSocket1 };

        weaponColl1 = weaponSocket1.GetComponent <BoxCollider2D>();
        weaponColl2 = weaponSocket2.GetComponent <BoxCollider2D>();
        Physics2D.IgnoreCollision
            (weaponColl2, GetComponent <BoxCollider2D>());
        Physics2D.IgnoreCollision
            (weaponColl1, GetComponent <BoxCollider2D>());
        InitNewInventory();

        ActivateWeapon(inventory.Weapons[0]);


        // 2. check if save file exists -load if exists -make a new one if not---------------------------------------------------

        /*if (File.Exists(Application.dataPath + "/savedata/HubData.test"))
         * {
         *  hubSaveData = SaveSystem.Loadhubsavedata();
         *  inventory.SetCredits(hubSaveData.credits);
         *  Debug.Log("HubDataLoaded" + hubSaveData.credits);
         * }
         * else
         * {
         *  hubSaveData = new HubSaveData(10);
         *  inventory.SetCredits(hubSaveData.credits);
         * }
         * if (File.Exists(Application.dataPath + "/savedata/autoSaveData.test"))
         * {
         *  LoadAndSetPlayer(SaveSystem.LoadAutoSaveData());
         * }
         * else { CreateAutoSaveData(); } // causing Curl error 56: Receiving data failed with unitytls error code 1048578
         *
         */
        //3. inventory UI init (assential??) commented out - not in use.

        //4. Direction indication
        directionIndication = transform.Find("DirectionIndication");
        sprite = directionIndication.transform.Find("DirectionSprite");
        directionIndicationSprite = sprite.GetComponent <SpriteRenderer>();
        //dIColor = directionIndicationSprite.color;

        //5. State UI init( hp bar etc )
        GameObject stateUIInstanceFixe = Instantiate(stateUIPrefabFixe,/*Vector3.Zero*/
                                                     new Vector3(0.0f, 3000.0f, 0.0f), Quaternion.identity) as GameObject;

        stateUIFixe = stateUIInstanceFixe.GetComponentInChildren <StateUI>();
        stateUIFixe.Init(this, true, true);// character, hasEnergy, isFixed

        //GetInventory().AddCredits(10);//tmp
        stateUIFixe.UpdateCredits();//tmp

        //6.VFX init
        gainEnergyEffect = Resources.Load <GameObject>("Prefabs/Effects/DropEnergyEffect");
        justOnceSmoke    = new bool[2];

        //7. etc

        gm = GameObject.Find("GameManager").GetComponent <GameManager>();

        //8. initiated! (needed for cameraControl. )
        initiated = true;
        stateUII  = GameObject.Find("PlayerStateUI(Clone)");
        stateUII.GetComponent <StateUI>().Refresh();
        //bonus
        justOnceSmoke = new bool[2];

        //9. initate player die effect
        deadEffectObj     = transform.Find("DeadEffect").gameObject;
        deadEffectAnimObj = transform.Find("DeadEffectAnim").gameObject;
        playerDeadBody    = GameObject.Find("Player").transform.Find("PlayerDeadBody").gameObject;

        playerMainBody = new GameObject[6];

        playerMainBody[0] = GameObject.Find("Player").transform.Find("Body").gameObject;
        playerMainBody[1] = GameObject.Find("Player").transform.Find("Face").gameObject;
        playerMainBody[2] = GameObject.Find("Player").transform.Find("Hand1").gameObject;
        playerMainBody[3] = GameObject.Find("Player").transform.Find("Hand2").gameObject;
        playerMainBody[4] = GameObject.Find("Player").transform.Find("Foot1").gameObject;
        playerMainBody[5] = GameObject.Find("Player").transform.Find("Foot2").gameObject;


        //load and set data

        playerComb            = GetComponent <PlayerCombatV1>();
        playerComb.weapons[0] = GetActiveWeapon();

        //saveSystemManager.InitSaveData();

        stateUIFixe.Refresh();
    }