本文整理汇总了C#中Door.Hover方法的典型用法代码示例。如果您正苦于以下问题:C# Door.Hover方法的具体用法?C# Door.Hover怎么用?C# Door.Hover使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Door
的用法示例。
在下文中一共展示了Door.Hover方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
void Update()
{
LayerMask layer = ShootMode ? shootLayer : doorLayer;
bool isHit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 1000, layer);
if (ShootMode)
{
if (isHit)
{
if (hit.collider != null)
{
if (hit.collider.transform.tag == "SelectionCollider")
{
if (targetCharacter != null)
{
if (targetCharacter != hit.transform)
targetCharacter.IsSelected = false;
}
targetCharacter = hit.collider.GetComponent<CharacterMouseOver>();
targetCharacter.IsSelected = true;
}
else if (targetCharacter != null)
{
targetCharacter.IsSelected = false;
targetCharacter = null;
}
}
else if(targetCharacter != null)
{
targetCharacter.IsSelected = false;
targetCharacter = null;
}
}
else if (targetCharacter != null)
{
targetCharacter.IsSelected = false;
targetCharacter = null;
}
if (Input.GetButtonDown("Left_Click") && targetCharacter != null)
{
Debug.Log("Play shoot");
Source.PlayOneShot(Shoot);
Source.PlayOneShot(BruitageCri[Random.Range(0,BruitageCri.Length)]);
if (targetCharacter.transform.parent.tag == "Player")
endGame.DetectiveWins();
else
endGame.WrongKillerKilled();
enabled = false;
}
}
else
{
if (isHit)
{
if (energy > 0 && hit.collider.tag == "DoorCollider")
{
//find door
targetDoor = hit.collider.GetComponent<Door>();
targetDoor.Hover();
}
}
else
{
if (targetDoor != null)
{
targetDoor.HoverOut();
}
targetDoor = null;
}
if (Input.GetButtonDown("Left_Click") && energy > 0 && targetDoor != null)
{
energy = Mathf.Max(0, energy - 1);
targetDoor.Close();
OnDoorOpen.Invoke();
}
}
}