示例#1
0
    void ShootPortal(int noPortal)
    {
        RaycastHit hit;

        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, range))
        {
            portalCooldownLeft = portalCooldown;
            if (hit.transform.tag == "Portable")
            {
                GameObject aTransform = new GameObject();
                aTransform.transform.position = hit.point;
                aTransform.transform.rotation = Quaternion.LookRotation(hit.normal);
                if (hit.transform.GetComponent <Wall>() != null)
                {
                    portalManager.CreatePortal(noPortal, aTransform.transform);
                }
                else
                {
                    float rotation = 0;
                    if (Vector3.Dot(hit.transform.up, Vector3.down) > 0)
                    {
                        rotation = -gameObject.transform.rotation.eulerAngles.y;
                    }
                    else
                    {
                        rotation = gameObject.transform.rotation.eulerAngles.y + 180;
                    }
                    aTransform.transform.Rotate(new Vector3(0, 0, rotation));
                    portalManager.CreatePortal(noPortal, aTransform.transform);
                }
                Destroy(aTransform);
            }
        }
    }
示例#2
0
 public void Open(bool cheat = false)
 {
     PortalManager.CloseAllDoors();
     isOpening = true;
     if (cheat)
     {
         symmetricDoor = GameObject.FindGameObjectWithTag("RoomStack").GetComponent <RoomTower>().GetStartRoomDoor();
     }
     symmetricDoor.SymmetricalOpen();
     PortalManager.CreatePortal(portal, symmetricDoor.portal);
 }
示例#3
0
 /// <summary>
 /// TODO:仮実装
 /// 目線先の地面に作りたい
 /// </summary>
 public void CallCreatePortal()
 {
     portalManager.CreatePortal(mainCamera.transform.position += mainCamera.transform.forward * 5f, mainCamera.transform.forward);
 }