public void TalkMode()
{
//Talk to the object clicked on.
Ray ray ;
if (MouseLookEnabled==true)
{
ray =Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f));
}
else
{
//ray= Camera.main.ViewportPointToRay(Input.mousePosition);
ray= Camera.main.ScreenPointToRay(Input.mousePosition);
}
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(ray,out hit,talkRange))
{
if (hit.transform.gameObject.GetComponent<ObjectInteraction>()!=null)
{
hit.transform.gameObject.GetComponent<ObjectInteraction>().TalkTo();
}
}
else
{
UWHUD.instance.MessageScroll.Add ("Talking to yourself?");
}
}
void ClickEvent() { if (playerUW.PlayerMagic.ReadiedSpell != "") { Debug.Log("player has a spell to cast"); return; } switch (UWCharacter.InteractionMode) { case UWCharacter.InteractionModeOptions: //Options mode return; //do nothing break; case UWCharacter.InteractionModeTalk: //Talk playerUW.TalkMode(); break; case UWCharacter.InteractionModePickup: //Pickup if (playerUW.gameObject.GetComponent <PlayerInventory>().ObjectInHand != "") { JustClicked = true; //Prevent catching something I have just thrown. Invoke("ResetClick", 0.2f); ThrowObjectInHand(); } else { playerUW.PickupMode(); } break; case UWCharacter.InteractionModeLook: //look playerUW.LookMode(); //do nothing break; case UWCharacter.InteractionModeAttack: //attack playerUW.PlayerCombat.AttackModeMelee(); //do nothing break; case UWCharacter.InteractionModeUse: //Use if (playerUW.gameObject.GetComponent <PlayerInventory>().ObjectInHand != "") { //UseObjectInHand (); playerUW.UseMode(); } else { playerUW.UseMode(); } break; } }