private void OnCollisionEnter(Collision collision)
    {
        Weapons hitBy = Weapon.GetWeaponType(collision.gameObject);

        if (this.isOpened && hitBy == Weapons.Bottle && collision.transform != this.transform.parent)
        {
            Weapon weapon = collision.gameObject.GetComponentInChildren <Weapon>();
            if (weapon != null && this.babyFood != null)
            {
                this.babyFood.AttachedTo       = weapon.transform;
                this.babyFood.IsAttached       = true;
                this.babyFood.AttachedToWeapon = weapon;
            }
        }
        else if (!this.isOpened && hitBy == Weapons.Chainsaw)
        {
            this.isOpened = true;
            if (this.anim != null && this.animClip != null)
            {
                this.anim.clip = this.animClip;
                this.anim.Play(this.animClip.name);
                this.anim[this.animClip.name].wrapMode = WrapMode.Once;
            }
        }
        else if (hitBy != Weapons.Bottle && hitBy != Weapons.Chainsaw && hitBy != Weapons.None)
        {
            ScenarioManager.GetCurrentScenario().SetFlag <Weapons, BabyScenario.Flags>(hitBy, BabyScenario.Flags.FoodDestroyed, true);
        }
    }
    private void OnCollisionEnter(Collision collision)
    {
        Weapons hitBy = Weapon.GetWeaponType(collision.gameObject);

        if (hitBy == Weapons.Knife)
        {
            this.audio.Stop();

            ScenarioManager.GetCurrentScenario().SetFlag <Weapons, BabyScenario.Flags>(Weapons.Knife, BabyScenario.Flags.BabyChanged, true);
            if (this.anim != null && this.animClip != null)
            {
                this.anim.clip = this.animClip;
                this.anim.Play(this.animClip.name);
                this.anim[this.animClip.name].wrapMode = WrapMode.Once;

                if (this.idleAnimClip != null)
                {
                    this.anim.PlayQueued(this.idleAnimClip.name);
                    this.anim[this.idleAnimClip.name].wrapMode = WrapMode.Once;
                }

                Collider[] colliders = this.GetComponentsInChildren <Collider>();
                for (int i = 0; i < colliders.Length; ++i)
                {
                    colliders[i].enabled = false;
                }
            }
        }
        else if (hitBy != Weapons.None)
        {
            ScenarioManager.GetCurrentScenario().SetFlag <Weapons, BabyScenario.Flags>(hitBy, BabyScenario.Flags.BabyPopped, true);
        }
    }
Exemple #3
0
    void OnGUI()
    {
        //Don't draw anything if the enum type has not been specified
        if (this.enumType == null)
        {
            return;
        }

        //Retrieve the list of enum values as ints
        int[] enumValues = EnumUtil.ArrayFromEnum(this.enumType);

        //Build the output text
        string debugText = "";

        foreach (int val in enumValues)
        {
            //Retrieve the enum value's name
            string valName = System.Enum.Parse(this.enumType, val.ToString()).ToString();

            //Determine whether or not the flag is set
            bool flagSet = ScenarioManager.GetCurrentScenario().GetFlag(val).value;

            //Append the line to the output
            debugText += valName + ": " + (flagSet ? "Set" : "Unset") + "\n";
        }

        GUI.color           = Color.black;
        GUI.backgroundColor = new Color(0, 0, 0, 0);
        GUI.Label(new Rect(0, 0, 999999, 999999), debugText);
    }
Exemple #4
0
 void OnTriggerEnter(Collider other)
 {
     //If the table entered the target zone, set the flag accordingly
     if (other.gameObject.tag == "Table")
     {
         ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, CandleRoomScenario.Flags.TableInPosition, true);
     }
 }
    private void OnTriggerEnter(Collider collider)
    {
        if (collider.GetComponent <Candle>() != null)
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, CandleRoomScenario.Flags.CandleDoused, true);

            GameObject.Destroy(collider.GetComponent <Candle>().Flame);
        }
    }
Exemple #6
0
    private void OnCollisionEnter(Collision collision)
    {
        Weapons weaponType = Weapon.GetWeaponType(collision.gameObject);

        if (weaponType != Weapons.None)
        {
            ScenarioManager.GetCurrentScenario().SetFlag(weaponType, DogRoomScenario.Flags.DogDestroyed, true);
        }
    }
 void Start()
 {
     //When both of the curtains are on fire, start the sprinkler
     ScenarioManager.GetCurrentScenario().RegisterFlagTrigger(
         EnumUtil.ValuesToArray(new [] { CandleRoomScenario.Flags.LeftCurtainOnFire, CandleRoomScenario.Flags.RightCurtainOnFire }),
         new int[] {},
         new FlagTriggerDelegate(this.OnCurtainsOnFire),
         true              //isOneShot
         );
 }
    void OnCollisionEnter(Collision collision)
    {
        if (Weapon.GetWeaponType(collision.gameObject) == Weapons.FlameThrower)
        {
            //Remove the RigidBody from the fire that hit the curtain
            Destroy(collision.gameObject.GetComponent <Rigidbody>());
            Destroy(collision.collider);

            //Set the flag to indicate this curtain is on fire
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.FlameThrower, this.curtainFlag, true);
        }
    }
Exemple #9
0
    private void OnCollisionEnter(Collision collision)
    {
        Weapons weaponType = Weapon.GetWeaponType(collision.gameObject);

        if (weaponType == Weapons.BoxingGloves)
        {
            ScenarioManager.GetCurrentScenario().SetFlag(weaponType, DogRoomScenario.Flags.BoardKnockedAway, true);

            this.resetPosition += new Vector3(-100.0f, 0.0f, 0.0f);

            this.IsResetting = true;
        }
    }
    private void Update()
    {
        if (this.IsAttached && this.AttachedTo != null)
        {
            Physics.IgnoreCollision(this.playerCollider, this.GetComponent <Collider>());

            this.transform.position = this.AttachedTo.position + this.AttachedTo.forward * 0.1f;
        }

        if (IsAttached && AttachedToWeapon == null)
        {
            ScenarioManager.GetCurrentScenario().SetFlag <Weapons, BabyScenario.Flags>(Weapons.Bottle, BabyScenario.Flags.FoodDestroyed, true);
            Destroy(this.gameObject);
        }
    }
Exemple #11
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.GetComponent <Skateboard>() == null)
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.Gun, DogRoomScenario.Flags.PoopMissed, true);
        }
        else
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.Gun, DogRoomScenario.Flags.PoopCaught, true);

            this.transform.parent = collision.transform;
            this.transform.GetComponent <Rigidbody>().isKinematic = true;
        }

        Destroy(this);
    }
    void OnCollisionEnter(Collision collision)
    {
        if (!broken && Weapon.GetWeaponType(collision.gameObject) == Weapons.Sword)
        {
            foreach (Transform child in this.transform)
            {
                child.gameObject.AddComponent <Rigidbody>();
            }

            this.transform.DetachChildren();

            broken = true;

            //Set the flag to indicate this curtain is on fire
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.Sword, this.curtainFlag, true);
        }
    }
    void OnCollisionEnter(Collision collision)
    {
        if (Weapon.GetWeaponType(collision.gameObject) == Weapons.BoxingGloves)
        {
            if (!moved)
            {
                if (chair.Broken)
                {
                    this.GetComponent <Animation>().Play(moveAnimationName);

                    moved = true;

                    //Set the flag to indicate this curtain is on fire
                    ScenarioManager.GetCurrentScenario().SetFlag(Weapons.BoxingGloves, this.curtainFlag, true);
                }
                else
                {
                    this.GetComponent <Animation>().Play(shakeAnimationName);
                }
            }
        }
    }
Exemple #14
0
    private void OnCollisionEnter(Collision collision)
    {
        Weapons weaponType = Weapon.GetWeaponType(collision.gameObject);

        if (weaponType == Weapons.Bat)
        {
            ScenarioManager.GetCurrentScenario().SetFlag(weaponType, DogRoomScenario.Flags.BoardRetrieved, true);

            this.skateboard.transform.parent = null;
            this.skateboard.IsResetting      = true;

            this.transform.rotation *= Quaternion.Euler(0.0f, 0.0f, -90.0f);

            MonoBehaviour.Destroy(this);
        }
        else if (weaponType != Weapons.None)
        {
            ScenarioManager.GetCurrentScenario().SetFlag(weaponType, DogRoomScenario.Flags.BoardKilled, true);

            this.transform.rotation *= Quaternion.Euler(0.0f, 0.0f, -90.0f);

            MonoBehaviour.Destroy(this);
        }
    }
    private void OnCollisionEnter(Collision collision)
    {
        Weapons hitBy = Weapon.GetWeaponType(collision.gameObject);

        if (hitBy != Weapons.None)
        {
            if (hitBy == Weapons.Bottle && this.babyFood != null && this.babyFood.AttachedToWeapon != null && this.babyFood.AttachedToWeapon.WeaponType == Weapons.Bottle)
            {
                ScenarioManager.GetCurrentScenario().SetFlag <Weapons, BabyScenario.Flags>(Weapons.None, BabyScenario.Flags.BabyFed, true);
                Destroy(this.babyFood.gameObject);
            }
            else
            {
                ScenarioManager.GetCurrentScenario().SetFlag <Weapons, BabyScenario.Flags>(hitBy, BabyScenario.Flags.BabyPopped, true);
                if (this.anim != null)
                {
                    this.audio.Stop();

                    this.anim.Stop();
                    Destroy(this.anim);
                }
            }
        }
    }
Exemple #16
0
 private void OnPoopMissed(int cause)
 {
     Debug.Log("YOU MISSED THE POOP!");
     Debug.Log("CURRENT SCENARIO: " + ScenarioManager.GetCurrentScenario());
     ScenarioManager.GetCurrentScenario().LoseScenario((Weapons)cause);
 }
Exemple #17
0
 private void OnBoardKilled(int cause)
 {
     Debug.Log("YOU KILLED THE BOARD!");
     Debug.Log("CURRENT SCENARIO: " + ScenarioManager.GetCurrentScenario());
     ScenarioManager.GetCurrentScenario().LoseScenario((Weapons)cause);
 }
Exemple #18
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(0, 0, 100, 100), "Set Flag 1"))
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, ExampleScenario.Flags.FlagOne, true);
        }

        if (GUI.Button(new Rect(100, 0, 100, 100), "Set Flag 2"))
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, ExampleScenario.Flags.FlagTwo, true);
        }

        if (GUI.Button(new Rect(200, 0, 100, 100), "Set Flag 3"))
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, ExampleScenario.Flags.FlagThree, true);
        }

        if (GUI.Button(new Rect(300, 0, 100, 100), "Set Flag 4"))
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, ExampleScenario.Flags.FlagFour, true);
        }

        if (GUI.Button(new Rect(400, 0, 100, 100), "Set Flag 5"))
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, ExampleScenario.Flags.FlagFive, true);
        }

        if (GUI.Button(new Rect(0, 100, 100, 100), "Unset Flag 1"))
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, ExampleScenario.Flags.FlagOne, false);
        }

        if (GUI.Button(new Rect(100, 100, 100, 100), "Unset Flag 2"))
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, ExampleScenario.Flags.FlagTwo, false);
        }

        if (GUI.Button(new Rect(200, 100, 100, 100), "Unset Flag 3"))
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, ExampleScenario.Flags.FlagThree, false);
        }

        if (GUI.Button(new Rect(300, 100, 100, 100), "Unset Flag 4"))
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, ExampleScenario.Flags.FlagFour, false);
        }

        if (GUI.Button(new Rect(400, 100, 100, 100), "Unset Flag 5"))
        {
            ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, ExampleScenario.Flags.FlagFive, false);
        }

        string debugText = "";

        debugText += "Flag 1: " + ScenarioManager.GetCurrentScenario().GetFlag(ExampleScenario.Flags.FlagOne) + "\n";
        debugText += "Flag 2: " + ScenarioManager.GetCurrentScenario().GetFlag(ExampleScenario.Flags.FlagTwo) + "\n";
        debugText += "Flag 3: " + ScenarioManager.GetCurrentScenario().GetFlag(ExampleScenario.Flags.FlagThree) + "\n";
        debugText += "Flag 4: " + ScenarioManager.GetCurrentScenario().GetFlag(ExampleScenario.Flags.FlagFour) + "\n";
        debugText += "Flag 5: " + ScenarioManager.GetCurrentScenario().GetFlag(ExampleScenario.Flags.FlagFive) + "\n";
        GUI.TextArea(new Rect(0, 250, 999999, 200), debugText);
    }
Exemple #19
0
 private void OnDogRescued(int cause)
 {
     Debug.Log("YOU RESCUED THE DOG!");
     Debug.Log("CURRENT SCENARIO: " + ScenarioManager.GetCurrentScenario());
     ScenarioManager.GetCurrentScenario().WinScenario();
 }
Exemple #20
0
 private void OnBabyDoused(int cause)
 {
     Debug.Log("YOU DOUSED THE BABY!");
     Debug.Log("CURRENT SCENARIO: " + ScenarioManager.GetCurrentScenario());
     ScenarioManager.GetCurrentScenario().WinScenario();
 }
Exemple #21
0
 private void OnFoodDestroyed(int cause)
 {
     Debug.Log("YOU DESTROYED THE FOOD!");
     Debug.Log("CURRENT SCENARIO: " + ScenarioManager.GetCurrentScenario());
     ScenarioManager.GetCurrentScenario().LoseScenario((Weapons)cause);
 }
 private void OnCurtainsOnFire(int cause)
 {
     //Start the sprinkler
     ScenarioManager.GetCurrentScenario().SetFlag(cause, CandleRoomScenario.Flags.SprinklersOn, true);
     GameObject.Instantiate(this.emitter);
 }