示例#1
0
    public void Awake()
    {
        instance = this;

        int l = valid_elements.Length;

        for (int i = 0; i < l; ++i)
        {
            if (valid_elements[i].instance != null)
            {
                valid_elements[i].instance.GetComponent <MagicFunction>().idx = i;
                valid_elements[i].idx = i;
            }
        }
    }
示例#2
0
	void PlayerReady(MagicElements element)
    {
		player.element = element;
		player.setReady(true);
    }
示例#3
0
	// Fire < Ice < Tree < Fire
	Result GetElementsCounterResult(MagicElements playerElement, MagicElements enemyElement) {
		if(playerElement == MagicElements.Fire && enemyElement == MagicElements.Ice) {
			return Result.Lose;
		}
		if (playerElement == MagicElements.Fire && enemyElement == MagicElements.Tree) {
			return Result.Win;
		}
		if(playerElement == MagicElements.Ice && enemyElement == MagicElements.Fire) {
			return Result.Win;
		}
		if(playerElement == MagicElements.Ice && enemyElement == MagicElements.Tree) {
			return Result.Lose;
		}
		if(playerElement == MagicElements.Tree && enemyElement == MagicElements.Fire) {
			return Result.Lose;
		}
		if(playerElement == MagicElements.Tree && enemyElement == MagicElements.Ice) {
			return Result.Win;
		}
		return Result.Draw;
	}
示例#4
0
    /*
    void Duel()
	{
        Result elementCounterResult = GetElementsCounterResult(player.skill,enemy.skill,player.element, enemy.element);

		Debug.Log("player = " + player.element.ToString() + ", Enemy = " + enemy.element.ToString() + ", Result = " + elementCounterResult.ToString());

		if (player.hp > 0 && enemy.hp > 0) {
				switch(elementCounterResult) {
			case Result.Win:
                    StartCoroutine("Damage", aniEnemy);
                    player.Attack(enemy);
                    break;
				case Result.Lose:
                    StartCoroutine("Damage", aniPlayer);
                    enemy.Attack(player);
					break;
				case Result.Draw:
                    break;
			}
			UM.HideUi ();
		}

		player.HealthBar.value = player.hp;
		enemy.HealthBar.value = enemy.hp;
		Debug.Log("player HP = " + player.hp + ", Enemy HP = " + enemy.hp);

		if(player.hp == 0 || enemy.hp == 0)
        {
			EndThisGame ();
		}

		player.setReady(false);
		enemy.setReady(false);
    }

    */

    // Fire < Ice < Tree < Fire
    Result GetElementsCounterResult(MagicElements playerElement, MagicElements enemyElement)
    {
        if (playerElement == MagicElements.Fire && enemyElement == MagicElements.Ice)
        {
            effectIce.transform.position = playerPos;
            //effectIce.SetActive(true);
            return Result.Lose;
        }
        if (playerElement == MagicElements.Fire && enemyElement == MagicElements.Tree)
        {
            effectFire.transform.position = enemyPos;
            //effectFire.SetActive(true);
            return Result.Win;
        }
        if (playerElement == MagicElements.Ice && enemyElement == MagicElements.Fire)
        {
            effectIce.transform.position = enemyPos;
            //effectIce.SetActive(true);
            return Result.Win;
        }
        if (playerElement == MagicElements.Ice && enemyElement == MagicElements.Tree)
        {
            effectTree.transform.position = playerPos;
            //effectTree.SetActive(true);
            return Result.Lose;
        }
        if (playerElement == MagicElements.Tree && enemyElement == MagicElements.Fire)
        {
            effectFire.transform.position = playerPos;
            //effectFire.SetActive(true);
            return Result.Lose;
        }
        if (playerElement == MagicElements.Tree && enemyElement == MagicElements.Ice)
        {
            effectTree.transform.position = enemyPos;
            //effectTree.SetActive(true);
            return Result.Win;
        }

        return Result.Draw;

    }