Exemplo n.º 1
0
    public void CookReady()
    {
        this.status = "cooked";
        Destroy(gameObject);
        GameObject        cooked = Instantiate(cookedMeat, transform.position, Quaternion.identity) as GameObject;
        CookingController cookedCookingController = cooked.GetComponent <CookingController>();

        cookedCookingController.status     = "done";
        cookedCookingController.TimeToCook = this.TimeToCook;
        cookedCookingController.isCooking  = this.isCooking;

        // mudar o objeto pro legalzao =)
    }
Exemplo n.º 2
0
 void Awake()
 {
     current = this;
 }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        //enderer.enabled
        for (int i = 0; i < Input.touchCount; i++)
        {
            currTouch = i;

            RaycastHit2D[] hitInfos = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.GetTouch(i).position), Vector2.zero);

            foreach (RaycastHit2D hitInfo in hitInfos)
            {
                if (hitInfo.collider != null)
                {
                    lastCollider = hitInfo.collider.tag;
                    switch (hitInfo.collider.tag)
                    {

                        case "vl1_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("vl1_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "vl2_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("vl2_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "vl3_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("vl3_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "l1_left":
                                if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("l1_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "l2_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("l2_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "l3_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("l3_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "m1_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("m1_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "m2_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("m2_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "m3_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("m3_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "m4_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("m4_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "hm1_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("hm1_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "hm2_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("hm2_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "hm3_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("hm3_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "hm4_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("hm4_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "h1_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("h1_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "h2_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("h2_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "h3_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("h3_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "h4_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("h4_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "h5_left":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(1f, 1f, 1f);
                                FlipGameObject(false);
                                animator.SetTrigger("h5_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;

                        case "vl1_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("vl1_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "vl2_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("vl2_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "vl3_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("vl3_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "l1_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("l1_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "l2_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("l2_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "l3_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("l3_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "m1_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("m1_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "m2_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("m2_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "m3_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("m3_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "m4_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("m4_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "hm1_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("hm1_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "hm2_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("hm2_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "hm3_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("hm3_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "hm4_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("hm4_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "h1_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("h1_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "h2_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                animator.SetTrigger("h2_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "h3_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("h3_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "h4_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("h4_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        case "h5_right":
                            if (Input.GetTouch(i).phase == TouchPhase.Began)
                            {
                                //this.transform.localScale = new Vector3(-1f, 1f, 1f);
                                FlipGameObject(true);
                                animator.SetTrigger("h5_left");
                                SetPlayerIdleEvent(false);
                            }
                            break;
                        /**************/

                    }
                    if (hitInfo.collider.tag == "CookSpot" && Input.GetTouch(i).phase == TouchPhase.Began)
                    {
                        CookingController cc = new CookingController();
                        GameObject cookingObject = hitInfo.collider.gameObject;
                        cc = hitInfo.collider.gameObject.GetComponent<CookingController>();
                        Vector3 position = new Vector3(hitInfo.collider.gameObject.transform.position.x, 0,0);
                        if (cc.hasBacon && !cc.baconBuffer)
                        {
                            //pass int 1 - 6 instead of actual hp amount
                            switch (cc.currentState)
                            {
                                case CookingController.cookingStates.raw:
                                    EatBaconEvent(position, 1);
                                    Toolbox.Instance.raw++;
                                    break;
                                case CookingController.cookingStates.undercooked:
                                    Toolbox.Instance.under++;
                                    EatBaconEvent(position, 2);
                                    break;
                                case CookingController.cookingStates.almost:
                                    Toolbox.Instance.almost++;
                                    EatBaconEvent(position, 3);
                                    break;

                                case CookingController.cookingStates.perfect:
                                    Toolbox.Instance.perfect++;
                                    EatBaconEvent(position, 4);
                                    break;
                                case CookingController.cookingStates.crispy:
                                    Toolbox.Instance.crispy++;
                                    EatBaconEvent(position, 5);
                                    break;
                                case CookingController.cookingStates.burnt:
                                    Toolbox.Instance.burnt++;
                                    EatBaconEvent(position, 6);
                                    break;

                            }
                            cc.TakeBacon("");

                        } else if (!cc.hasBacon && !cc.baconBuffer)
                        {
                            cc.AddBacon(cookingObject.name);
                        } else
                        {
                            print(cc.name + " bacon buffer = " + cc.baconBuffer);
                        }
                    }
                    /*if (hitInfo.collider.tag == "shark" && Input.GetTouch(i).phase == TouchPhase.Began)
                    {
                        //call the sharks hit function
                        print("shark is getting hit");
                        SharkController sc = new SharkController();
                        sc = hitInfo.collider.gameObject.GetComponentInParent<SharkController>();
                        if(sc.currentState != SharkController.sharkStates.swim)
                        {
                            Toolbox.Instance.sharkHitCount += 1;
                            sc.GetHit();
                        }
                    }*/

                    if (hitInfo.collider.tag == "baconStack" && Input.GetTouch(i).phase == TouchPhase.Began)
                    {
                        //print ("bacon stack touched");
                        GameObject go = hitInfo.collider.gameObject;

                        if(go == null)
                        {

                            print ("game object is null");
                        }
                        BaconStackController bsc = go.GetComponent<BaconStackController> ();
                        bsc.GrabNewBacon(Input.GetTouch(currTouch).fingerId);
                    }
                    /*
                    if (hitInfo.collider.tag == "bird" && Input.GetTouch(i).phase == TouchPhase.Began)
                    {
                        //call the sharks hit function
                        print ("bird hit");
                        GameObject go = hitInfo.collider.gameObject;
                        BirdController bc = go.GetComponentInParent<BirdController> ();
                        Toolbox.Instance.birdHitCount++;
                        bc.GetHit();
                    }

                    if (hitInfo.collider.tag == "octopus" && Input.GetTouch(i).phase == TouchPhase.Began)
                    {
                        //call the sharks hit function
                        print ("octopus hit");
                        GameObject go = hitInfo.collider.gameObject;
                        OctopusController bc = go.GetComponentInParent<OctopusController> ();
                        Toolbox.Instance.birdHitCount++;
                        bc.GetHit();
                    }

                    if (hitInfo.collider.tag == "dolphin" && Input.GetTouch(i).phase == TouchPhase.Began)
                    {
                        //call the sharks hit function
                        print ("dolphin hit");
                        GameObject go = hitInfo.collider.gameObject;
                        DolphinController bc = go.GetComponentInParent<DolphinController> ();
                        Toolbox.Instance.birdHitCount++;
                        bc.GetHit();
                    }*/
                    if (hitInfo.collider.gameObject.tag == "pauseButton" && Input.GetTouch(i).phase == TouchPhase.Ended)
                    {
                        if (Input.GetTouch(i).phase == TouchPhase.Ended)
                        {
                        //print ("pause button");
                        pause_button pb = hitInfo.collider.gameObject.GetComponent<pause_button>();
                        pb.PauseTheGame();
                        }
                    }

                    if (hitInfo.collider.gameObject.tag == "retry" && Input.GetTouch(i).phase == TouchPhase.Ended)
                    {
                        if (Input.GetTouch(i).phase == TouchPhase.Ended)
                        {
                            //print ("retry button");
                            Time.timeScale = 1.0f;
                            Application.LoadLevel("MainGame");
                            Time.timeScale = 1.0f;

                        }
                    }

                    if (hitInfo.collider.gameObject.tag == "cat" && Input.GetTouch(i).phase == TouchPhase.Ended)
                    {
                        if (Input.GetTouch(i).phase == TouchPhase.Ended)
                        {
                            //print ("cat attack");
                            CatController cc = hitInfo.collider.gameObject.GetComponent<CatController>();
                            cc.CatButton();

                        }
                    }

                    //if currTouch hits the guiTexture
                    if (Input.GetTouch(i).phase == TouchPhase.Began)
                    {
                        //when the button first starts to be hit, change it's appearance?
                        OnTouchBegan2();
                        //print ("2Are we here?2");

                    }
                    if (Input.GetTouch(i).phase == TouchPhase.Ended)
                    {
                        //when the button is let up, change it back to original?
                        OnTouchEnded2();
                        //print ("2touchphase ended2");
                    }
                }

            }
        }
    }
Exemplo n.º 4
0
 public CookingManager()
 {
     cook = Main.Character.cookingController;
 }
Exemplo n.º 5
0
    public void Fire()
    {
        baconSpotScript = baconSpot.GetComponent<CookingController>();
        thisRenderer = gameObject.GetComponent<SpriteRenderer>();

        foreach (GameObject go in GameObject.FindGameObjectsWithTag("Player"))
        {
            //float distance = go.transform.position.x - transform.position.x;
            //print("distance = " + distance);
            if ((transform.position.x) < 0)
            {
                goRight = false;
            } else
            {
                goRight = true;
            }

            //float diff = (go.transform.position - transform.position).sqrMagnitude;

        }

        if (transform.localScale.x < 1)
        {

            print("parent of weird one = " + transform.localScale.x);
            Toolbox.Instance.smallCount++;
        }

        //boatEdge = GameObject.Find("touch_zone1");
        //print(boatEdge);
        //screenEdge = GameObject.Find("touch_zone2");

        currentState = sharkStates.alert;
        bite = false;
    }
Exemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     cookingController = GetComponentInParent <CookingController>();
     modifier          = GetComponentInChildren <UIInventoryText>().modifier;
 }
Exemplo n.º 7
0
 public bool HasBacon( CookingController c)
 {
     return c.hasBacon;
 }
Exemplo n.º 8
0
    public void Fire()
    {
        baconSpotScript = baconSpot.GetComponent<CookingController>();

        if ((transform.position.x) < 0)
        {
            goRight = true;
            //p2dControl.flip = false;
            FlipGameObject(dolphinOrientation.facingRight);
        }
        else
        {
            goRight = false;
            //p2dControl.flip = true;
            FlipGameObject(dolphinOrientation.facingLeft);
        }

        //print("boat edge" + boatEdge);

        startRotationY = transform.rotation.eulerAngles.y;
        startLocalZ = transform.localScale.z;
        //print("starting Y = " + startRotationY);
        currentState = dolphinStates.alert;
    }
Exemplo n.º 9
0
    public void Fire()
    {
        baconSpotScript = baconSpot.GetComponent<CookingController>();
        thisRenderer = gameObject.GetComponent<SpriteRenderer>();

        if ((transform.position.x) < 0)
        {
            goRight = false;
            //p2dControl.flip = false;
            FlipGameObject(false);
        }
        else
        {
            goRight = true;
            //p2dControl.flip = true;
            FlipGameObject(true);
        }

        //boatEdge = GameObject.Find("touch_zone1");
        print(boatEdge);
        //screenEdge = GameObject.Find("touch_zone2");

        currentState = octopusStates.alert;
    }
Exemplo n.º 10
0
    public void Fire()
    {
        //flying = true;
        float distance = Mathf.Infinity;
        //var distance = Mathf.Infinity;

        baconSpotScript = baconSpot.GetComponent<CookingController>();
        //GameObject.Find("Cooking_Left");
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("Player"))
        {
            if ((transform.position.x) < 0)
            {
                goRight = false;
            } else
            {
                goRight = true;
            }

            float diff = (go.transform.position - transform.position).sqrMagnitude;

            if (diff < distance)
            {
                distance = diff;
                target = go.transform;
            }
        }

        currentState = birdStates.alert;
    }