// Use this for initialization
 void Start()
 {
     Book      = GameObject.Find("New Book");
     Spotlight = GameObject.Find(KingdomName + " Spot Light");
     Spotlight.SetActive(false);
     swipeScript = Book.GetComponent <SwipeScript>();
 }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        this.transform.localRotation = Quaternion.identity;

        if ((Input.GetKeyDown(KeyCode.UpArrow) && onGround) || (SwipeScript.GetTouch() == 0 && onGround))
        {
            GetComponent <ConstantForce2D>().force = new Vector3(0f, 30f, 0f);
            //animator.SetTrigger("Flip");
            this.transform.localScale = new Vector3(0.9764434f, -0.9764434f, 0.9764434f);
            onGround = false;
            GetComponent <AudioSource>().Play();
        }

        if ((Input.GetKeyDown(KeyCode.DownArrow) && onGround) || (SwipeScript.GetTouch() == 1 && onGround))
        {
            GetComponent <ConstantForce2D>().force = new Vector3(0f, -30f, 0f);
            this.transform.localScale = new Vector3(0.9764434f, 0.9764434f, 0.9764434f);
            onGround = false;
            GetComponent <AudioSource>().Play();
        }

        if (Input.GetMouseButtonDown(0))
        {
            GetComponent <ConstantForce2D>().force = new Vector3(0f, -1 * GetComponent <ConstantForce2D>().force.y, 0f);
            this.transform.localScale = new Vector3(this.transform.localScale.x, -1 * transform.localScale.y, transform.localScale.z);
            onGround = false;
            GetComponent <AudioSource>().Play();
        }

        if (this.transform.position.x < 0)
        {
            Lose.LoseGame();
        }
    }
Exemple #3
0
 public SavedData(SwipeScript swipeData)
 {
     dontKnowScore      = swipeData.IDontKnowScore.text;
     knowScore          = swipeData.IKnowScore.text;
     cardSpriteName     = swipeData.cardSpriteName;
     dontKnowSpriteName = swipeData.dontKnowSpriteName;
     dontKnowFlag       = swipeData.dontKnowFlag;
 }
Exemple #4
0
 void Start()
 {
     kol.SetActive(false);
     anim          = gameObject.GetComponent <Animator>();
     boxCol2d      = transform.GetComponent <BoxCollider2D>();
     charRigid     = gameObject.GetComponent <Rigidbody2D>();
     swipe         = gameObject.GetComponent <SwipeScript>();
     joint         = gameObject.GetComponent <DistanceJoint2D>();
     joint.enabled = false;
     ipAtildi      = false;
 }
Exemple #5
0
 void Awake()
 {
     if (mInstance == null)
     {
         mInstance = this;
     }
     else if (mInstance != this)
     {
         Destroy(this.gameObject);
     }
 }
Exemple #6
0
    public static void SaveData(SwipeScript swipeData)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/savedData.dat";

        FileStream stream = new FileStream(path, FileMode.Create);

        SavedData data = new SavedData(swipeData);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Exemple #7
0
    void Start()
    {
        cam = Camera.main;

        cardImage.sprite     = card.cardImage;
        cardName.text        = card.cardName;
        cardDescription.text = card.cardDescription;

        swipeRef = FindObjectOfType <SwipeScript>();
        swipeObj = GetComponent <SwipeableObject> ();

        myTransform = GetComponent <Transform>();
    }
Exemple #8
0
    public void ToggleColliders(bool state)
    {
        for (int i = 0; i < allBoxColl.Length; i++)
        {
            allBoxColl[i].enabled = state;
        }

        playerMov.SetInfo(state); //activa y desactiva el input de movimiento del alien

        SwipeScript swipe = playerMov.GetComponent <SwipeScript>();

        if (state)
        {
            Time.timeScale = 1;
            swipe.enabled  = true;
        }
        else
        {
            swipe.enabled  = false;
            Time.timeScale = 0;
        }
    }
Exemple #9
0
    private void checkIfSwiped()
    {
        SwipeScript swipeScript = gameObject.GetComponent <SwipeScript>();

        if (swipeScript.movingLeft)
        {
            swipeScript.movingLeft = false;
            imageIndex--;
            if (imageIndex < 0)
            {
                imageIndex = m_selectedObject.m_images.Length - 1;
            }
        }
        else if (swipeScript.movingRight)
        {
            swipeScript.movingRight = false;
            imageIndex++;
            if (imageIndex >= m_selectedObject.m_images.Length)
            {
                imageIndex = 0;
            }
        }
    }
Exemple #10
0
    void Awake()
    {
        if (PlayerPrefs.GetInt("FirstTime") == 1)
        {
            longInstruction.gameObject.SetActive(true);
            ShortInstruction.gameObject.SetActive(true);
        }
        SwipeScript.speedUpVal = 0;
        speed = 4;
        doublePointText.gameObject.SetActive(false);
        timeText.gameObject.SetActive(false);
        switch (UseBall.colour)
        {
        case UseBall.COLOURS.BLUE:
            gameObject.GetComponent <Renderer>().material = _BlueMaterial;
            PlayerPrefs.SetInt("SuckerPower", 1);
            int blueball = PlayerPrefs.GetInt("BlueBalls");
            blueball--;
            PlayerPrefs.SetInt("BlueBalls", blueball);
            startingPower = true;
            break;

        case UseBall.COLOURS.YELLOW:
            gameObject.GetComponent <Renderer>().material = _YellowMaterial;
            SwipeScript.IncreaseSpeed();
            int yellowBall = PlayerPrefs.GetInt("YellowBalls");
            yellowBall--;
            PlayerPrefs.SetInt("YellowBalls", yellowBall);
            startingPower = true;
            break;

        case UseBall.COLOURS.RED:
            gameObject.GetComponent <Renderer>().material     = _RedMaterial;
            gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePositionY;
            int redBall = PlayerPrefs.GetInt("RedBalls");
            redBall--;
            PlayerPrefs.SetInt("RedBalls", redBall);
            startingPower = true;
            break;

        case UseBall.COLOURS.GREEN:
            gameObject.GetComponent <Renderer>().material = _GreenMaterial;
            int greenBall = PlayerPrefs.GetInt("GreenBalls");
            greenBall--;
            PlayerPrefs.SetInt("GreenBalls", greenBall);
            startingPower = true;
            break;

        case UseBall.COLOURS.ORANGE:
            gameObject.GetComponent <Renderer> ().material = _OrangeMaterial;
            SwipeScript.DecreaseSpeed();
            int orangeBall = PlayerPrefs.GetInt("OrangeBalls");
            orangeBall--;
            PlayerPrefs.SetInt("OrangeBalls", orangeBall);
            startingPower = true;
            break;

        default:
            gameObject.GetComponent <Renderer>().material = _OriginalMaterial;
            break;
        }
    }
Exemple #11
0
    void DoubleTimeMaterial()
    {
        GameObject baller = GameObject.Find("Ball");

        //GameObject baller = GameObject.Find("Pokeball");
        if (baller.gameObject.GetComponent <Renderer>().sharedMaterial == _BlueMaterial || baller.gameObject.GetComponent <Renderer>().sharedMaterial == _RedMaterial ||
            baller.gameObject.GetComponent <Renderer>().sharedMaterial == _GreenMaterial || baller.gameObject.GetComponent <Renderer>().sharedMaterial == _YellowMaterial ||
            baller.gameObject.GetComponent <Renderer>().sharedMaterial == _OrangeMaterial)
        {
            powerUp = true;
            doublePointText.gameObject.SetActive(true);
            if (baller.gameObject.GetComponent <Renderer>().sharedMaterial == _GreenMaterial)
            {
                doublePointText.text = "DOUBLE POINTS";
            }
            if (baller.gameObject.GetComponent <Renderer>().sharedMaterial == _YellowMaterial)
            {
                doublePointText.text = "SONIC SPEED";
                SwipeScript.IncreaseSpeed();
            }
            if (baller.gameObject.GetComponent <Renderer>().sharedMaterial == _BlueMaterial)
            {
                doublePointText.text = "SONIC SUCTION";
            }
            if (baller.gameObject.GetComponent <Renderer>().sharedMaterial == _RedMaterial)
            {
                doublePointText.text = "ANTI-GRAVITY";
            }
            if (baller.gameObject.GetComponent <Renderer> ().sharedMaterial == _OrangeMaterial)
            {
                doublePointText.text = "SLOW MOTION";
                SwipeScript.DecreaseSpeed();
            }


            timeText.gameObject.SetActive(true);

            if (startTimer)
            {
                timer += Time.deltaTime;
            }

            if (startingPower)
            {
                timeText.text = Convert.ToString(Convert.ToInt32(60.0f - timer));
            }
            else
            {
                timeText.text = Convert.ToString(Convert.ToInt32(15.0f - timer));
            }

            if ((startingPower && timer > 60) || (!startingPower && timer > 15))
            {
                powerUp = false;
                timeText.gameObject.SetActive(false);
                doublePointText.gameObject.SetActive(false);
                if (baller.gameObject.GetComponent <Renderer>().sharedMaterial == _BlueMaterial)
                {
                    PlayerPrefs.SetInt("SuckerPower", 0);
                }
                if (baller.gameObject.GetComponent <Renderer>().sharedMaterial == _RedMaterial)
                {
                    baller.gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None;
                }
                if (baller.gameObject.GetComponent <Renderer>().sharedMaterial == _YellowMaterial)
                {
                    SwipeScript.speed -= 2;
                }
                if (baller.gameObject.GetComponent <Renderer>().sharedMaterial == _OrangeMaterial)
                {
                    SwipeScript.speed += 2;
                }

                if (startingPower)
                {
                    baller.gameObject.GetComponent <Renderer>().material = _OriginalMaterial;
                    doublePointText.gameObject.SetActive(false);
                    startingPower = false;
                }

                baller.gameObject.GetComponent <Renderer>().material = _OriginalMaterial;
                UseBall.colour = UseBall.COLOURS.NONE;
                PlayerPrefs.SetInt("RedPickUp", 0);
                PlayerPrefs.SetInt("BluePickUp", 0);
                PlayerPrefs.SetInt("OrangePickUp", 0);
                PlayerPrefs.SetInt("YellowPickUp", 0);
                PlayerPrefs.SetInt("GreenPickUp", 0);
                timer = 0;
            }
        }
    }
 void Awake()
 {
     cardController = FindObjectOfType <CardControl>();
     swipe          = FindObjectOfType <SwipeScript>();
     myTransform    = this.GetComponent <RectTransform>();
 }
Exemple #13
0
    // Update is called once per frame
    void Update()
    {
        Spins.text = spinCount.ToString();
        if (rpmValue == int.MaxValue)
        {
            RPMText.text = "0";
        }
        else
        {
            RPMText.text = ((int)rpmValue).ToString();
        }

        if (shouldRotate)
        {
            rotateAngle = rotationSpeed * rpmValue * Time.deltaTime;

            //Debug.Log("Rotate Angle: " + rotateAngle);

            switch (rotateDirection)
            {
            case RotateDirection.CLOCKWISE:

                transform.Rotate(Vector3.back, rotateAngle);

                break;

            case RotateDirection.ANTICLOCKWISE:

                transform.Rotate(Vector3.forward, rotateAngle);

                break;
            }
            angleSum += rotateAngle;

            if (angleSum / 360 > 1)
            {
                spinCount++;
                angleSum -= 360;
            }
        }

        if (rpmValue <= 0)
        {
            shouldRotate    = false;
            isgamePlaying   = false;
            rotateDirection = RotateDirection.AMBIGUOUS;
        }
        if (rpmValue > 0 && shouldRotate)
        {
            //greaseValue += greaseValue / 2;
            rpmValue -= (greaseValue * Time.deltaTime);
        }

        if (!isgamePlaying)
        {
            isgamePlaying  = !isgamePlaying;
            shouldRotate   = false;
            rotateDuration = float.MaxValue;
            rpmValue       = int.MaxValue;
            SwipeScript.setMaxSwipe(1);

            // Update User Max Score........
            if (PlayerPrefs.HasKey("maxScore"))
            {
                int previousMaxScore = PlayerPrefs.GetInt("maxScore");

                if (previousMaxScore < spinCount)
                {
                    PlayerPrefs.SetInt("maxScore", spinCount);
                }
            }
            else
            {
                PlayerPrefs.SetInt("maxScore", spinCount);
            }

            gameScore.text = spinCount.ToString();
            spinCount      = 0;
            angleSum       = 0.0f;
            playingCanvas.SetActive(false);   // Hide Playing Canvas When Fidget Stop Spins........
            gameResultCanvas.SetActive(true); // Show gameResult Canvas ...........
        }
    }
Exemple #14
0
 private void Start()
 {
     health = 150;
     script = manager.GetComponent <SwipeScript>();
 }