public void MeditateButton()
 {
     timeBetweenTurns    = attackTime.floatingPoint;
     preFightText.text   = playerInfo.identityName + ": CALMS THERE MIND AND HEALS " + enemyInfo.identityName + ".";
     playerHealth.value *= 1.25f;
     moveSounds[3].Play();
     battle = battleState.enemyTurn;
 }
Example #2
0
 public void StartBattle()
 {
     for (int i = 4; i < 8; i++)
     {
         eStatMods[i] += Mathf.Clamp(enemySpecies.baseStats[i] / 25, 1, 999) * eStatMods[0];
     }
     eStatMods[3] = eStats[4];
     curState     = battleState.idle;
 }
 public void DefendButton()
 {
     timeBetweenTurns    = attackTime.floatingPoint;
     preFightText.text   = playerInfo.identityName + ": DEFENDS FROM " + enemyInfo.identityName + "!";
     playerInfo.defence  = playerInfo.startDefence;
     playerInfo.defence += (playerInfo.defence * playerInfo.boost);
     playerInfo.boost    = 1;
     moveSounds[1].Play();
     battle = battleState.enemyTurn;
 }
Example #4
0
    private int clearScore;     // クリア条件のスコア

    // Use this for initialization
    void Start()
    {
        state = battleState.battleStart;
        timer = 0;
        messageStart.enabled = true;
        messageWin.enabled   = false;
        messageLose.enabled  = false;
        score      = 0;
        clearScore = EnemyInstantiate.instantiateValue;
    }
 public void AttackButton()
 {
     timeBetweenTurns   = attackTime.floatingPoint;
     preFightText.text  = playerInfo.identityName + ": STRIKES " + enemyInfo.identityName + "!";
     enemyHealth.value -= ((playerInfo.attack * playerInfo.boost) - enemyInfo.defence);
     playerInfo.boost   = 1;
     playerInfo.defence = playerInfo.startDefence;
     moveSounds[0].Play();
     battle = battleState.enemyTurn;
 }
Example #6
0
    // Use this for initialization
    void Start()
    {
        bs = battleState.WAIT;
        ps = playerState.SELECT;
        memeP.AddRange(GameObject.FindGameObjectsWithTag("Meme"));
        enemyE.AddRange(GameObject.FindGameObjectsWithTag("Enemy"));

        playerUI.SetActive(false);
        enemyUI.SetActive(false);
    }
 public void BoostButton()
 {
     timeBetweenTurns   = attackTime.floatingPoint;
     preFightText.text  = playerInfo.identityName + ": BOOST IN POWER!";
     playerInfo.defence = playerInfo.startDefence;
     if (playerInfo.boost <= playerInfo.startBoost + 4)
     {
         playerInfo.boost += 1;
     }
     moveSounds[2].Play();
     battle = battleState.enemyTurn;
 }
    private void Awake()
    {
        playerInfo      = PullPush.player;
        playerSelection = PullPush.playerCharacter;

        afterFightButton.interactable  = false;
        playerDeathButton.interactable = false;
        demonkidBeaten.interactable    = false;
        battle           = battleState.talking;
        timeBetweenTurns = attackTime.floatingPoint;
        SelectedFoe(enemyLevel.number);
        PlayerCharacter(playerSelection.number);
    }
 private void PlayerTurn()
 {
     if (playerHealth.value <= 0)
     {
         battle = battleState.playerDefeat;
     }
     else
     {
         attack.interactable   = true;
         defend.interactable   = true;
         boost.interactable    = true;
         meditate.interactable = true;
     }
 }
Example #10
0
    // Update is called once per frame
    void Update()
    {
        switch (state)
        {
        case battleState.battleStart:       // 開始時
            timer += Time.deltaTime;
            if (timeEnableMsg < timer)
            {
                messageStart.enabled = false;
                state = battleState.battlePlay;
                timer = 0;
            }
            break;

        case battleState.battlePlay:        // プレー中
            if (clearScore <= score)        // クリアスコアをこえた
            {
                state = battleState.battleEnd;
                messageWin.enabled = true;
            }
            if (PlayerAp.armorPoint <= 0)     // ゲームオーバー
            {
                state = battleState.battleEnd;
                messageLose.enabled = true;
            }
            break;

        case battleState.battleEnd:         // 終了処理
            timer += Time.deltaTime;
            if (timeEnableMsg < timer)
            {
                Time.timeScale = 0;         // 動きを止める
                if (Input.GetButtonDown("Fire1"))
                {
                    SceneManager.LoadScene("Title");
                    Time.timeScale = 1;     // 動きを再開
                }
            }
            break;

        default:
            break;
        }
    }
Example #11
0
	// Use this for initialization
	void Start () {

        /*
         * What we gon do
         * 
         * On start, get the player data from the PlayerData class
         * Create objects and give the battle components to those objects
         * play some gosh darn vidya games
         * */
        //PlayerData.getPlayer();
        initPlayers();
        initEnemies();

		currentState =  battleState.start;

		canvas = GameObject.Find ("Canvas");
		
		bottomPanel = GameObject.Find ("BottomPanel").GetComponent<RectTransform>();
		topPanel = GameObject.Find ("TopPanel").GetComponent<RectTransform>();

	}
Example #12
0
    // Update is called once per frame
    void Update()
    {
        switch (curState)
        {
        case battleState.idle:
            eMonBattler.sprite = enemySpecies.speciesPortrait;
            pMonBattler.sprite = playerMon.species.speciesPortrait;
            enemyTimer        += Time.deltaTime * 20;
            playerTimer       += Time.deltaTime * ((float)playerMon.stats[7] / (float)eStats[7]) * 20;

            eHealth.maxValue = eStats[4];
            eHealth.value    = eStatMods[3];
            pHealth.maxValue = playerMon.stats[4];
            pHealth.value    = playerMon.statMods[3];


            if (enemyTimer >= 100)
            {
                curState = battleState.enemy;
            }
            if (playerTimer >= 100)
            {
                powerGauge.gameObject.SetActive(true);
                powerGauge.value = 0;
                curState         = battleState.player;
            }
            if (eStatMods[3] <= 0)
            {
                playerMon.statMods[2] += 100;                 //REPLACE WITH BETTER FORMULA
                curState = battleState.inactive;
                GameObject.Find("FarmManager").GetComponent <fmScript>().curState = fmScript.playerState.farm;
                GameObject.Find("FarmManager").GetComponent <fmScript>().MoveCamera();
                this.enabled = false;
            }
            if (playerMon.statMods[3] <= 0)
            {
                playerMon.statMods[2] += 50;                 //REPLACE WITH BETTER FORMULA
                GameObject.Find("FarmManager").GetComponent <fmScript>().curState = fmScript.playerState.farm;
                GameObject.Find("FarmManager").GetComponent <fmScript>().MoveCamera();
                curState     = battleState.inactive;
                this.enabled = false;
            }
            break;

        case battleState.enemy:
            enemyTimer             = 0;
            playerMon.statMods[3] -= (int)Mathf.Clamp((((float)(eStats[0] * 2) / 5) + 2) * ((float)eStats[5] / (float)playerMon.stats[6]), 1, 9999);
            curState = battleState.idle;
            break;

        case battleState.player:
            playerTimer = 0;
            if (increasing)
            {
                powerGauge.value += Time.deltaTime * 200;
                if (powerGauge.value >= 100)
                {
                    increasing = false;
                }
            }
            else
            {
                powerGauge.value -= Time.deltaTime * 200;
                if (powerGauge.value <= 0)
                {
                    increasing = true;
                }
            }
            if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonUp(0) || Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
            {
                if (powerGauge.value < 16.5 || powerGauge.value > 83.5)
                {
                    multiplier = .75f;
                }
                else if (powerGauge.value < 33 || powerGauge.value > 67)
                {
                    multiplier = 1;
                }
                else if (powerGauge.value < 40 || powerGauge.value > 60)
                {
                    multiplier = 1.25f;
                }
                else if (powerGauge.value < 45 || powerGauge.value > 55)
                {
                    multiplier = 1.5f;
                }
                else
                {
                    multiplier = 1.75f;
                }
                eStatMods[3] -= (int)(Mathf.Clamp((((float)(playerMon.stats[0] * 2) / 5) + 2) * ((float)playerMon.stats[5] / (float)eStats[6]), 1, 9999) * multiplier);
                powerGauge.gameObject.SetActive(false);
                curState = battleState.idle;
            }
            break;
        }
    }
Example #13
0
	// Update is called once per frame

	/*
	 * Control Flow
	 * ------------
	 * 1) List action options
	 * 2) List all of the players who can use that option
	 * 3) List the individual options within that action type
	 * 4) List the opponents on which you can use the action on
	 * 5) Commence actoin on target
	 * 6) Revert to step one until win/lose condition
	 * 
	 * */
	void Update () {

		if (checkIfAllDead (opponents)) {
			currentState = battleState.win;
		} else if (checkIfAllDead (players)) {
			currentState = battleState.lose;
		}

		switch (currentState) {

		case (battleState.start):
			battleStart();
			break;
		case (battleState.player):

            //Check if all the players have attacked
			bool allAttacked = false;
			foreach(GameObject player in players){
				allAttacked = player.GetComponent<BattleComponent>().attacked;
				if(allAttacked == false){
					break;
				}
			}

            //if they all attacked, switch over to opponent's turn
            //if they didn't, just keep going until all of the players have attacked
			if(allAttacked){

				foreach(GameObject player in players){
					player.GetComponent<BattleComponent>().attacked = false;
				}

				currentState = battleState.opponent;
				setBotButtons(false);
			}
			break;
		case (battleState.opponent):
			opponentTurn();
			break;
		case (battleState.lose):
            endBattle();
			break;
		case (battleState.win):
            endBattle();
			break;
        case (battleState.flee):
            endBattle();
            break;
		}
	}
Example #14
0
	private void opponentTurn(){
		Debug.Log ("Enemy took turn");
		currentState = battleState.player;
		setBotButtons (true);
	}
Example #15
0
	private void battleStart(){
		attackButton = createButton ("Attck", bottomPanel);
		attackButton.onClick.AddListener (() => selectActionMode(typeOfAction.attack));
		attackButton.onClick.AddListener (() => listUserButtons(players));

		attackButton.onClick.AddListener (() => setBotButtons(false));

		itemButton = createButton("ITM", bottomPanel);

		currentState = battleState.player;
	}
    private void EnemyTurn()
    {
        if (enemyHealth.value <= 0)
        {
            afterFightButton.interactable = true;
            battle = battleState.enemyDefeat;
        }
        else
        {
            attack.interactable   = false;
            defend.interactable   = false;
            boost.interactable    = false;
            meditate.interactable = false;

            int r;
            r = enemyInfo.favoredMoves[Random.Range(0, 10)];
            switch (r)
            {
            case 0:
                if (timeBetweenTurns < 0)
                {
                    playerHealth.value -= ((enemyInfo.attack * enemyInfo.boost) - playerInfo.defence);
                    enemyInfo.defence   = enemyInfo.startDefence;
                    enemyInfo.boost     = 1;
                    preFightText.text   = enemyInfo.identityName + ": ATTACKS!";
                    moveSounds[0].Play();
                    battle = battleState.playerTurn;
                }
                else
                {
                    timeBetweenTurns -= Time.deltaTime;
                }
                break;

            case 1:
                if (timeBetweenTurns < 0)
                {
                    enemyInfo.defence = enemyInfo.startDefence;
                    enemyInfo.boost  += 1;
                    preFightText.text = enemyInfo.identityName + ": BOOST IN POWER!";
                    enemyInfo.boost   = 1;
                    moveSounds[2].Play();

                    battle = battleState.playerTurn;
                }
                else
                {
                    timeBetweenTurns -= Time.deltaTime;
                }
                break;

            case 2:
                if (timeBetweenTurns < 0)
                {
                    enemyInfo.defence  = enemyInfo.startDefence;
                    enemyInfo.defence += (enemyInfo.defence * enemyInfo.boost);
                    enemyInfo.boost    = 1;
                    preFightText.text  = enemyInfo.identityName + ": DEFENDS ITSELF!";
                    moveSounds[1].Play();

                    battle = battleState.playerTurn;
                }
                else
                {
                    timeBetweenTurns -= Time.deltaTime;
                }
                break;

            case 3:
                if (timeBetweenTurns < 0)
                {
                    enemyHealth.value *= 1.25f;
                    preFightText.text  = enemyInfo.identityName + ": CALMS ITS MIND TO RESTORE HEALTH";
                    moveSounds[3].Play();

                    battle = battleState.playerTurn;
                }
                else
                {
                    timeBetweenTurns -= Time.deltaTime;
                }
                break;
            }
        }
    }
 public void CloseTextStartBattle()
 {
     preFightText.text        = "";
     closeButton.interactable = false;
     battle = battleState.playerTurn;
 }
Example #18
0
    // Update is called once per frame
    void Update()
    {
        //Debug.Log (action.Count);
        switch (bs)
        {
        case (battleState.WAIT): {
            if ((action.Count > 0) && (playerMeme[0].transform.Find("Selector").gameObject.activeSelf))
            {
                Debug.Log("aaaa");
                bs = battleState.ACTION;
            }
            break;
        }

        case (battleState.ACTION): {
            GameObject atkp = GameObject.Find(action[0].meme);
            if (action[0].type == "Enemy")
            {
                EnemySM ESM = atkp.GetComponent <EnemySM> ();
                ESM.atktarget = action [0].def;
                ESM.curState  = EnemySM.enemyState.ACTION;
            }

            if (action[0].type == "Meme")
            {
                MemeSM MSM = atkp.GetComponent <MemeSM> ();
                MSM.target   = action [0].def;
                MSM.curState = MemeSM.charState.ACTION;
            }

            bs = battleState.PERFORM;
            break;
        }

        case (battleState.PERFORM): {
            break;
        }
        }

        switch (ps)
        {
        case (playerState.WAITING): {
            break;
        }

        case (playerState.SELECT): {
            if (playerMeme.Count > 0)
            {
                //playerMeme [0].transform.Find ("Selector").gameObject.SetActive (true);
                //playerUI.SetActive (true);
                ps = playerState.WAITING;
            }
            break;
        }

        case (playerState.INPUT): {
            break;
        }

        case (playerState.DONE): {
            break;
        }
        }
    }