예제 #1
0
	IEnumerator Start() 
	{
		UniRPGGlobal.Instance.OnMenusLoaded(); // tell UnIRPG that the menu is loaded

		gui = UniRPGGlobal.DB.menuGUIData.GetComponent<DefaultMainMenuGUIData>();

		// init New Screen defaults
		newCharacter = UniRPGGlobal.MainMenuData.GetDefaultPlayerCharacter(UniRPGGlobal.DB.playerCanSelectCharacter);
		if (newCharacter == null) Debug.LogError("Could not find a default player character. There must be at least one Actor (PlayerCharacter) set as 'Avail at Start'");

		if (UniRPGGlobal.DB.playerCanSelectClass)
		{
			if (newCharacter != null) newClass = UniRPGGlobal.MainMenuData.GetDefaultPlayerClass(newCharacter.Actor);
		}

		// wait a frame before doing the following
		yield return null;

		CalcRecs();

		// ready
		SetState(State.MainMenu);

		AudioListener.volume = UniRPGGlobal.DB.audioMainVolume;

		// start random song
		if (gui.menuMusic.Count > 0)
		{
			int id = 0;
			if (gui.menuMusic.Count > 1) id = Random.Range(0, gui.menuMusic.Count);
			music = camObject.AddComponent<AudioSource>();
			music.clip = gui.menuMusic[id];
			music.volume = UniRPGGlobal.DB.musicVolume;
			music.bypassEffects = true;
			music.bypassReverbZones = true;
			music.bypassListenerEffects = true;
			music.loop = true;
			music.Play();
		}

		// create buton click audio source if needed
		if (gui.sfxButton)
		{
			sfxButton = camObject.AddComponent<AudioSource>();
			sfxButton.clip = gui.sfxButton;
			sfxButton.volume = UniRPGGlobal.DB.guiAudioVolume;
			sfxButton.playOnAwake = false;
			sfxButton.bypassEffects = true;
			sfxButton.bypassReverbZones = true;
			sfxButton.bypassListenerEffects = true;
			sfxButton.loop = false;
		}
	}
예제 #2
0
		protected override void OnCharacterTargeted(bool becomeTargeted, CharacterBase character)
		{
			int id = 0;
			if (character.ActorType() == UniRPGGlobal.ActorType.Neutral) id = 1;
			else if (character.ActorType() == UniRPGGlobal.ActorType.Hostile) id = 2;
			selectedCharaType = character.ActorType();
			UpdateSelectionRing(id, becomeTargeted, character.transform);
		}
예제 #3
0
	/// <summary>Remove a Character from the tracking list. should be called by Character when it is removed from the scene and was spawned by this SpawnPoint</summary>
	public void RemoveCharacter(CharacterBase chara)
	{
		spawned.Remove(chara);
	}
예제 #4
0
	// ================================================================================================================
	
	// these are called when something becomes targeted or untargeted and can be overwritten to listen for these events
	// a reference to the targeted object will be send. becomeTargeted=false means it was untargeted.

	protected virtual void OnCharacterTargeted(bool becomeTargeted, CharacterBase character) { }
예제 #5
0
	private void Draw_SelectCharacter()
	{
		if (gui.texLogo && (state == State.SelectName || gui.newGameCharaBackFab == null)) GUI.DrawTexture(rMenu[0], gui.texLogo);

		if (UniRPGGlobal.DB.playerCanSelectCharacter)
		{
			GUILayout.BeginArea(rNew[0], gui.labelSelectChara, GUI.skin.window);
			scroll[0] = GUILayout.BeginScrollView(scroll[0]);
			{
				foreach (CharacterBase chara in UniRPGGlobal.MainMenuData.playerCharacters)
				{	// show the characters that can be chosen from
					if (chara.Actor.availAtStart)
					{
						if (ListItem(newCharacter == chara, new GUIContent("  " + chara.Actor.screenName, chara.Actor.portrait[0]), gui.ListItem))
						{
							newCharacter = chara;
							LoadActorPreview(newCharacter.gameObject);
						}
					}
				}
			}
			GUILayout.EndScrollView();
			GUILayout.EndArea();

			if (newCharacter)
			{
				if (!string.IsNullOrEmpty(newCharacter.Actor.description))
				{
					GUILayout.BeginArea(rNew[3], GUI.skin.box);
					scroll[2] = GUILayout.BeginScrollView(scroll[2]);
					GUILayout.Label(newCharacter.Actor.description);
					GUILayout.EndScrollView();
					GUILayout.EndArea();
				}
			}

		}

		if (UniRPGGlobal.DB.playerCanSelectClass)
		{
			GUILayout.BeginArea(rNew[1], gui.labelSelectClass, GUI.skin.window);
			scroll[1] = GUILayout.BeginScrollView(scroll[1]);
			{
				foreach (RPGActorClass c in UniRPGGlobal.DB.classes)
				{	// show the characters that can be chosen from
					if (c.availAtStart)
					{
						if (ListItem(newClass == c, new GUIContent("  " + c.screenName, c.icon[0]), gui.ListItem)) newClass = c;
					}
				}
			}
			GUILayout.EndScrollView();
			GUILayout.EndArea();

			if (newClass)
			{
				if (!string.IsNullOrEmpty(newClass.description))
				{
					GUILayout.BeginArea(rNew[4], GUI.skin.box);
					scroll[3] = GUILayout.BeginScrollView(scroll[3]);
					GUILayout.Label(newClass.description);
					GUILayout.EndScrollView();
					GUILayout.EndArea();
				}
			}
		}

		GUILayout.BeginArea(rNew[2], GUI.skin.box);
		{
			GUILayout.BeginHorizontal();
			{
				GUILayout.BeginVertical();
				{
					if (UniRPGGlobal.DB.playerCanChooseName)
					{
						GUILayout.Label("Name");
						newName = GUILayout.TextField(newName);
					}
				}
				GUILayout.EndVertical();
				GUILayout.FlexibleSpace();
				GUILayout.BeginVertical();
				{
					if (GUILayout.Button("Start"))
					{
						ButtonClickFX();
						SetState(State.CreateNewGame);
					}
					if (GUILayout.Button("Back"))
					{
						ButtonClickFX();
						SetState(State.MainMenu);
					}
				}
				GUILayout.EndVertical();
			}
			GUILayout.EndHorizontal();
		}
		GUILayout.EndArea();
	}
예제 #6
0
	// ================================================================================================================
	#region Init/Start

	public void Awake()
	{
		_tr = gameObject.transform;
		_character = gameObject.GetComponent<CharacterBase>();

		InAOESelectMode = false;
		currSkill = null;
		nextSkill = null;
		autoSkill = null;
		nextSkillTarget = null;
		autoSkillTarget = null;
		nextSkillMaxDistance = 0f;
	}