Deekshitha Namadevan Week 8 Assignment
Deekshitha Namadevan Week 8 Assignment
Create Events
using UnityEngine.SceneManagement;
using UnityEngine;
SceneManager.LoadScene("SampleScene");
Application.Quit();
}
● Now check the inspector in the game over panel
select UI and select Text and the game over panel created .
• And name this text as starting text /start text, change the
animation at 0 – 1, at 30 -1.5, at 60 – 1.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
swipeDown;
= false;
if (Input.GetMouseButtonDown(0))
tap = true;
isDraging = true;
startTouch = Input.mousePosition;
else if (Input.GetMouseButtonUp(0))
isDraging = false;
Reset();
#endregion
if (Input.touches.Length > 0)
if (Input.touches[0].phase == TouchPhase.Began)
tap = true;
isDraging = true;
startTouch = Input.touches[0].position;
}
else if (Input.touches[0].phase ==
TouchPhase.Ended || Input.touches[0].phase ==
TouchPhase.Canceled)
isDraging = false;
Reset();
#endregion
swipeDelta = Vector2.zero;
if (isDraging)
if (Input.touches.Length < 0)
swipeDelta = Input.touches[0].position -
startTouch;
else if (Input.GetMouseButton(0))
swipeDelta = (Vector2)Input.mousePosition -
startTouch;
//Which direction?
float x = swipeDelta.x;
float y = swipeDelta.y;
//Left or Right
if (x < 0)
swipeLeft = true;
else
swipeRight = true;
else
//Up or Down
if (y < 0)
swipeDown = true;
else
swipeUp = true;
Reset();
{
startTouch = swipeDelta = Vector2.zero;
isDraging = false;
● Now drag the code and attach it the player and check the Output