Example #1
0
 public void panel3()
 {
     if (gamemode == false)
     {
         PanelNumber = 3;
         prevpanel   = Panel3;
         Resultpanel.SetActive(false);
     }
     else
     {
         PanelNumber = 6;
         prevpanel   = Gamepanel;
     }
 }
Example #2
0
 // Use this for initialization
 void Start()
 {
     FadeImage.enabled = false;
     Mainpanel.SetActive(true);
     Panel1.SetActive(false);
     Panel2.SetActive(false);
     Panel3.SetActive(false);
     Panel4.SetActive(false);
     Panel5.SetActive(false);
     Gamepanel.SetActive(false);
     Resultpanel.SetActive(false);
     prevpanel   = Mainpanel;
     PanelNumber = 0;
     gamemode    = false;
     Timer       = false;
 }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.touchCount > 0)
        {
            Touch touch = Input.GetTouch(0);
            // Handle finger movements based on touch phase.
            switch (touch.phase)
            {
            // Record initial touch position.
            case TouchPhase.Began:
                startPos        = touch.position;
                directionChosen = false;
                break;

            // Determine direction by comparing the current touch position with the initial one.
            case TouchPhase.Moved:
                direction = touch.position - startPos;
                break;                    // Report that a direction has been chosen when the finger is lifted.

            case TouchPhase.Ended:
                directionChosen = true;
                break;
            }
        }
        if (directionChosen)
        {
            // Something that uses the chosen direction...
        }
        Debug.Log(PlayTime.Minute + " : " + PlayTime.Second);
        if (PlayTime.Minute > 0 && gamemode == true)
        {
            Timer    = true;
            PlayTime = PlayTime.AddSeconds(-Time.deltaTime);
        }
        else if (PlayTime.Second > 0 && gamemode == true)
        {
            PlayTime = PlayTime.AddSeconds(-Time.deltaTime);
            Timer    = true;
        }
        else if (PlayTime.Minute == 0 && PlayTime.Second == 0 && gamemode == true)
        {
            Resultpanel.SetActive(true);
            Timer = false;
        }
        systemtime.text = PlayTime.Hour.ToString() + " : " + PlayTime.Minute.ToString() + " : " + PlayTime.Second.ToString();
        Vector3 UPAxis   = AroundPoint.transform.TransformDirection(Vector3.up);
        Vector3 DOWNAxis = AroundPoint.transform.TransformDirection(Vector3.down);

        // Stage1.transform.RotateAround(target.transform.position, UPAxis, 50f * Time.deltaTime);
        Stage1.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
        // Stage2.transform.RotateAround(target.transform.position, UPAxis, 50f * Time.deltaTime);
        Stage2.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
        // Stage3.transform.RotateAround(target.transform.position, UPAxis, 50f * Time.deltaTime);
        Stage3.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
        // Stage4.transform.RotateAround(target.transform.position, UPAxis, 50f * Time.deltaTime);
        Stage4.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
        if (startPos.x > direction.x)
        {
            //Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;{
            Stage1.transform.RotateAround(target.transform.position, UPAxis, 50f * Time.deltaTime);
            Stage2.transform.RotateAround(target.transform.position, UPAxis, 50f * Time.deltaTime);
            Stage3.transform.RotateAround(target.transform.position, UPAxis, 50f * Time.deltaTime);
            Stage4.transform.RotateAround(target.transform.position, UPAxis, 50f * Time.deltaTime);
            // Debug.Log(startPos.x);
            // Debug.Log(direction.x);
        }
        else if (startPos.x < direction.x)
        {
            Stage1.transform.RotateAround(target.transform.position, DOWNAxis, 50f * Time.deltaTime);
            Stage2.transform.RotateAround(target.transform.position, DOWNAxis, 50f * Time.deltaTime);
            Stage3.transform.RotateAround(target.transform.position, DOWNAxis, 50f * Time.deltaTime);
            Stage4.transform.RotateAround(target.transform.position, DOWNAxis, 50f * Time.deltaTime);
            // Debug.Log(startPos.x);
            // Debug.Log(direction.x);
        }

        if (Input.GetKey(KeyCode.A))
        {
            //Inventory.AddItem(itemmana.GetComponent<Item>());
            Debug.Log("aa");
        }
        if (gamemode == true && Timer == true && itemruting + 10f < Time.time)
        {
            itemruting = Time.time;
            float rand = Random.Range(0, 99);
            if (rand <= 30)
            {
                Inventory.AddItem(itemmana1.GetComponent <Item>());
            }
            else if (rand >= 31 && rand <= 70)
            {
                Inventory.AddItem(itemmana2.GetComponent <Item>());
            }
            else
            {
                Inventory.AddItem(itemmana3.GetComponent <Item>());
            }
        }
    }