Esempio n. 1
0
    void GeneralActivation(AIDirector.stage stage, ScareData.minorScareTimes minScare, ScareData.majorScareTimes majScare, ScareData.comedyTimes comedy)
    {
        string prefabPath  = "Assets/AI/Scares/";
        string timerMethod = "Set";

        switch (stage)
        {
        case AIDirector.stage.minorScare:
            prefabPath  += "MinorScaresPrefabs/" + MIN_SCARE_NAMES + minScare.ToString();
            timerMethod += "Min";
            break;

        case AIDirector.stage.majorScare:
            prefabPath  += "MajorScaresPrefabs/" + MAJ_SCARE_NAMES + majScare.ToString();
            timerMethod += "Maj";
            break;

        case AIDirector.stage.comedy:
            prefabPath  += "ComedyPrefabs/" + comedy.ToString();
            timerMethod += "Com";
            break;
        }
        prefabPath  += ".prefab";
        timerMethod += "TimerAndType";
        Vector3    scarePosition = new Vector3(0, 0, 0);
        Quaternion scareRotation = new Quaternion(0, 0, 0, 0);
        GameObject scare         = new GameObject();
        Object     prefab        = AssetDatabase.LoadAssetAtPath(prefabPath, (typeof(GameObject))) as GameObject;

        scare = (GameObject)Instantiate(prefab, scarePosition, scareRotation);
        scare.AddComponent <ScareData> ();
        switch (stage)
        {
        case AIDirector.stage.minorScare:
            scare.GetComponent <ScareData> ().SendMessage(timerMethod, minScare, SendMessageOptions.DontRequireReceiver);
            break;

        case AIDirector.stage.majorScare:
            scare.GetComponent <ScareData> ().SendMessage(timerMethod, majScare, SendMessageOptions.DontRequireReceiver);
            break;

        case AIDirector.stage.comedy:
            scare.GetComponent <ScareData> ().SendMessage(timerMethod, comedy, SendMessageOptions.DontRequireReceiver);
            break;

        default:
            break;
        }
        scare.transform.position = FindScarePosition(scare.GetComponent <ScareData> ().Type);
        CreateHierarchy(scare);
        //activeScares.Add (scare);
    }
Esempio n. 2
0
    void ExecuteStage(stage stg)
    {
        executing = true;
        switch (stg)
        {
        case stage.minorScare:
            scaredMeter += SCARE_STEP;
            UpdateScaredMeter();
            ScareData.minorScareTimes minScare = UniformRandomMinScare();
            SendMessage("ActivateMinor", minScare, SendMessageOptions.DontRequireReceiver);
            betweenScareCounter = ReturnNormal() * SCARE_COUNTER_MULT;
            Debug.Log("minor: " + minScare.ToString());
            break;

        case stage.majorScare:
            ScareData.majorScareTimes majScare;
            do
            {
                majScare = UniformRandomMajScare();
            } while (!ScareData.MajorScarePool.Contains(majScare.ToString()));
            Debug.Log("major: " + majScare.ToString());
            SendMessage("ActivateMajor", majScare, SendMessageOptions.DontRequireReceiver);
            StartRelax();
            break;

        case stage.comedy:
            ScareData.comedyTimes comedy = UniformRandomComedy();
            SendMessage("ActivateComedy", comedy, SendMessageOptions.DontRequireReceiver);
            //Debug.Log ("activate comedy");
            StartRelax();
            break;

        default:
            break;
        }
    }