示例#1
0
    private void OnCollisionEnter2D(Collision2D coll)
    {
        // check to see if it's a pickupable prop
        if (coll.gameObject.tag == "CanHideIn")
        {
            PropsToHideIn theThingYouCanHideIn = coll.gameObject.GetComponent<PropsToHideIn>() as PropsToHideIn;
            if (theThingYouCanHideIn != null)
            {
                if (!coll.gameObject.GetComponent<PropsToHideIn>().SomeoneIsHidingInHere)
                {
                    currentProp = coll.gameObject;
                    CurrentPropToHideIn = currentProp.GetComponent<PropsToHideIn>();
                    readyToHide = true;
                    Vector3 pos = currentProp.transform.position + new Vector3(0, 0, -3f);
                    ActionButton.transform.position = pos;
                    ActionButton.transform.renderer.enabled = true;
                }
                else
                {
                    currentProp = null;
                    CurrentPropToHideIn = null;
                    readyToHide = false;

                    return;
                }
            }
        }
    }
示例#2
0
    private void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.gameObject.tag == "Thief")
        {
            if (!coll.gameObject.GetComponent<HideNSteal>().GetBeingTazed())
            {
                currentProp = coll.gameObject;
                currentPropType = propTypes.thief;
                readyToTaze = true;
                //Vector3 pos = currentProp.transform.position + new Vector3(0, 0, -3f);
                //ActionButton.transform.position = pos;
                //ActionButton.transform.renderer.enabled = true;
                thiefScript = currentProp.GetComponent<HideNSteal>();
            }
            else
            {
                currentProp = null;
                //CurrentPropToPickUp = null;
                //readyToPickup = false;

                return;
            }
        } else if (coll.gameObject.tag == "CanHideIn")

        {
            if (!coll.gameObject.GetComponent<PropsToHideIn>() != null)
            {
                print("YES!!!");
                currentProp = coll.gameObject;
                currentPropType = propTypes.hiding;
                CurrentPropToHideIn = coll.gameObject.GetComponent<PropsToHideIn>();
                readyToSearch = true;
                Vector3 pos = currentProp.transform.position + new Vector3(0, 0, -3f);
                ActionButton.transform.position = pos;
                ActionButton.transform.renderer.enabled = true;
                //thiefScript = currentProp.GetComponent<HideNSteal>();
            }
            else
            {
                currentProp = null;
                //CurrentPropToPickUp = null;
                //readyToPickup = false;

                return;
            }
        }
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        if (OuyaInput.GetButtonUp(OuyaButton.RB, Movement.observedPlayer))
        {
            myRBButtonIsReady = true;
        }

        if(totalDeath > 1)
        {
            if(!showingDeathScreen)
            {
                showingDeathScreen = true;
                //ShowDeathScreen();
            }

        }

        if(readyToTaze && currentPropType == propTypes.thief && currentProp != null)
        {
            if(Vector2.Distance(transform.position, currentProp.transform.position) < 2)
            {
                if(!tazing)
                {
                    ActionButton.transform.position = currentProp.transform.position + new Vector3(0, 0, -3f);
                    ActionButton.transform.renderer.enabled = true;
                }
                if (OuyaInput.GetButtonDown(OuyaButton.RB, Movement.observedPlayer))
                {
                    //Vector3 pos = currentProp.transform.position + new Vector3(0, 0, -3f);
                    ActionButton.transform.renderer.enabled = false;
                    tazing = true;
                    thiefScript.GettingTazed(true);
                    if(Network.connections.Length > 0)
                        thiefScript.networkView.RPC("NetGettingTazed",RPCMode.AllBuffered,true);
                    Movement.SetHiding(true);
                    //SPILNOGETLYD!!!!

                    //ProgressBar(true, pos);
                    //progress.transform.position = pos;
                    //progress.renderer.enabled = true;
                    //progress = (GameObject)Instantiate(progressBar, pos, Quaternion.identity);
                }

                if (OuyaInput.GetButtonUp(OuyaButton.RB, Movement.observedPlayer))
                {
                    //if (progress != null)
                    //{
                        //hidingCounterTime = 0;
                        //ActionButton.transform.renderer.enabled = true;
                        //ProgressBar(false);
                        Movement.SetHiding(false);
                        if(tazing)
                        {
                            tazing = false;
                            DeathCount();
                            thiefScript.KillFromTaze(this);
                            if(Network.connections.Length > 0)
                                thiefScript.networkView.RPC("NetKillFromTaze". RPCMode.AllBuffered);
                            currentProp = null;
                            currentPropType = propTypes.nothing;
                            readyToTaze = false;
                            thiefScript = null;
                        }

                        //progress.GetComponent<ProgressBar>().SetProgressTime(hidingCounterTime / CurrentPropToHideIn.HidingTime);
                        //Destroy(progress);
                    //}
                }

                if (OuyaInput.GetButton(OuyaButton.RB, Movement.observedPlayer) && myRBButtonIsReady)
                {
                    //hidingCounterTime += Time.deltaTime;
                    //bool hideNotRide = false;
                    //if (progress != null)
                    //{
                    //    if(currentPropType == propTypes.hiding)
                    //    {
                    //    	SetProgressTime(hidingCounterTime / CurrentPropToHideIn.HidingTime);
                    //    	hideNotRide = true;
                    //    }
                    //    else if(currentPropType == propTypes.car)
                    //    {
                    //    	SetProgressTime(ridingCounterTime / CurrentCarToRideIn.RidingTime);
                    //    	hideNotRide = false;
                    //    }
                    //
                    //    //progress.GetComponent<ProgressBar>().SetProgressTime(hidingCounterTime / CurrentPropToHideIn.HidingTime);
                    //}
                }
            } else
            {
                ActionButton.transform.renderer.enabled = false;
            }

        }

        if(readyToSearch && currentPropType == propTypes.hiding && currentProp != null)
        {
            if(Vector2.Distance(transform.position, currentProp.transform.position) < (currentProp.transform.localScale.x+currentProp.transform.localScale.y)/2)
            {
                //if(!tazing)
                //{
                //	ActionButton.transform.position = currentProp.transform.position + new Vector3(0, 0, -3f);
                //	ActionButton.transform.renderer.enabled = true;
                //}
                if (OuyaInput.GetButtonDown(OuyaButton.RB, Movement.observedPlayer))
                {
                    Vector3 pos = currentProp.transform.position + new Vector3(0, 0, -3f);
                    ActionButton.transform.renderer.enabled = false;
                    //tazing = true;
                    //thiefScript.GettingTazed(true);
                    Movement.SetHiding(true);
                    //SPILNOGETLYD!!!!

                    ProgressBar(true, pos);
                    //progress.transform.position = pos;
                    //progress.renderer.enabled = true;
                    //progress = (GameObject)Instantiate(progressBar, pos, Quaternion.identity);
                }

                if (OuyaInput.GetButtonUp(OuyaButton.RB, Movement.observedPlayer))
                {
                    //if (progress != null)
                    //{
                        searchingCounterTime = 0;
                        ActionButton.transform.renderer.enabled = true;
                        ProgressBar(false);
                        Movement.SetHiding(false);
                        //if(tazing)
                        //{
                        //	tazing = false;
                        //	thiefScript.KillFromTaze(this);
                        //	currentProp = null;
                        //	currentPropType = propTypes.nothing;
                        //	readyToTaze = false;
                        //	thiefScript = null;
                        //}

                        //progress.GetComponent<ProgressBar>().SetProgressTime(hidingCounterTime / CurrentPropToHideIn.HidingTime);
                        //Destroy(progress);
                    //}
                }

                if (OuyaInput.GetButton(OuyaButton.RB, Movement.observedPlayer) && myRBButtonIsReady)
                {
                    searchingCounterTime += Time.deltaTime;
                    //bool hideNotRide = false;
                    if (progress != null)
                    {
                        if(currentPropType == propTypes.hiding)
                        {
                            SetProgressTime(searchingCounterTime / CurrentPropToHideIn.HidingTime);
                            //hideNotRide = true;
                        }
                        //else if(currentPropType == propTypes.car)
                        //{
                        //	SetProgressTime(ridingCounterTime / CurrentCarToRideIn.RidingTime);
                        //	//hideNotRide = false;
                        //}

                        //progress.GetComponent<ProgressBar>().SetProgressTime(hidingCounterTime / CurrentPropToHideIn.HidingTime);
                    }
                    if (searchingCounterTime >= CurrentPropToHideIn.HidingTime)
                    {

                        // has hidden in prop - her sker magien

                        //if(hidingInCar)
                        //{
                        //	hidingInCar = false;
                        //	thievesInCar--;
                        //}
                        //hidden = false;
                        Movement.SetHiding(false);
                        transform.renderer.enabled = true;
                        collider2D.enabled = true;
                        CurrentPropToHideIn.SomeoneIsHidingInHere = false;
                        CurrentPropToHideIn.KickOutThief();
                        CurrentPropToHideIn = null;
                        currentProp = null;
                        ActionButton.transform.renderer.enabled = false;
                        searchingCounterTime = 0;
                        myRBButtonIsReady = false;
                        //SetPickupDisplay(true);
                        ProgressBar(false);
                    }
                }
            } else
            {
                ActionButton.transform.renderer.enabled = false;
            }
        }
    }
示例#4
0
    private void OnCollisionEnter2D(Collision2D coll)
    {
        // check to see if it's a pickupable prop
        if (coll.gameObject.tag == "CanHideIn")
        {
            PropsToHideIn theThingYouCanHideIn = coll.gameObject.GetComponent<PropsToHideIn>() as PropsToHideIn;

            if(theThingYouCanHideIn.isCar)
            {
                finalThiefScore += DepositCash();
            }

            if (theThingYouCanHideIn != null)
            {
                if (!coll.gameObject.GetComponent<PropsToHideIn>().SomeoneIsHidingInHere)
                {
                    SetCurrentPropAndType(coll.gameObject, propTypes.hiding);
                    CurrentPropToHideIn = currentProp.GetComponent<PropsToHideIn>();
                    readyToHide = true;
                    Vector3 pos = currentProp.transform.position + new Vector3(0, 0, -3f);
                    ActionButton.transform.position = pos;
                    ActionButton.transform.renderer.enabled = true;
                }
                else
                {
                    currentProp = null;
                    CurrentPropToHideIn = null;
                    readyToHide = false;

                    return;
                }
            }
        }
        else if (coll.gameObject.tag == "CanBePickedUp")
        {
            if (coll.gameObject.GetComponent<PropsToPickUp>().CanBePickedUp)
            {
                currentProp = coll.gameObject;
                currentPropType = propTypes.pickup;
                CurrentPropToPickUp = currentProp.GetComponent<PropsToPickUp>();
                readyToPickup = true;
                Vector3 pos = currentProp.transform.position + new Vector3(0, 0, -3f);
                ActionButton.transform.position = pos;
                ActionButton.transform.renderer.enabled = true;
            }
            else
            {
                currentProp = null;
                CurrentPropToPickUp = null;
                readyToPickup = false;

                return;
            }
        }
    }