Exemple #1
0
 /// <inheritdoc />
 public void TransitionToState(FireableWeaponState state)
 {
     Behavoir.StartCoroutine(FireWeapon());
 }
Exemple #2
0
    // compare
    void OnTriggerEnter(Collider other)
    {
        if (other.tag.Equals("Moveable") && gameObject.tag.Equals("Untagged"))
        {
            Behavoir    temp                  = other.gameObject.GetComponent <Behavoir>();
            BoxCollider boxcolliderOther      = other.GetComponent <BoxCollider>();
            BoxCollider boxcolliderThisObject = GetComponent <BoxCollider>();
            if (boxcolliderThisObject.enabled)
            {
                if (Col.Equals("red") && temp.Col.Equals("green"))
                {
                    Debug.Log("red and green");

                    FindObjectOfType <SoundPlayer>().playSound("Correct");
                    numberOfCollidersCorrect += 1;

                    other.transform.position = new Vector3(other.transform.position.x, transform.position.y, other.transform.position.z);

                    boxcolliderOther.isTrigger = true;


                    boxcolliderThisObject.enabled = !boxcolliderThisObject.enabled;

                    other.gameObject.tag = "Not Moveable";
                }
                else if (Col.Equals("green") && temp.Col.Equals("red"))
                {
                    Debug.Log("green and red");
                    FindObjectOfType <SoundPlayer>().playSound("Correct");
                    numberOfCollidersCorrect += 1;

                    other.transform.position = new Vector3(other.transform.position.x, transform.position.y, other.transform.position.z);

                    boxcolliderOther.isTrigger = true;

                    boxcolliderThisObject.enabled = !boxcolliderThisObject.enabled;

                    other.gameObject.tag = "Not Moveable";
                }
                else if (Col.Equals("blue") && temp.Col.Equals("purple"))
                {
                    Debug.Log("blue and purple");
                    FindObjectOfType <SoundPlayer>().playSound("Correct");
                    numberOfCollidersCorrect += 1;

                    other.transform.position   = new Vector3(other.transform.position.x, transform.position.y, other.transform.position.z);
                    boxcolliderOther.isTrigger = true;

                    boxcolliderThisObject.enabled = !boxcolliderThisObject.enabled;

                    other.gameObject.tag = "Not Moveable";
                }
                else if (Col.Equals("purple") && temp.Col.Equals("blue"))
                {
                    Debug.Log("purple and blue");

                    FindObjectOfType <SoundPlayer>().playSound("Correct");
                    numberOfCollidersCorrect += 1;

                    other.transform.position   = new Vector3(other.transform.position.x, transform.position.y, other.transform.position.z);
                    boxcolliderOther.isTrigger = true;

                    boxcolliderThisObject.enabled = !boxcolliderThisObject.enabled;
                    other.gameObject.tag          = "Not Moveable";
                }
                else
                {
                    //numberOfCollidersCorrect --;
                    other.gameObject.tag = "Moveable";
                    Debug.Log("now!");
                }
            }
            Debug.Log(numberOfCollidersCorrect);
            //Debug.Log("now!");
        }
    }