Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (puzzleCompletionMonsterIndex == -1)
        {
            spt_NetworkPuzzleLogic networkScript = GameObject.FindGameObjectWithTag("Player").GetComponent<spt_NetworkPuzzleLogic>();
            for (int i = 0; i < networkScript.PuzzleStates.Count; i++)
            {
                if (networkScript.PuzzleStates[i].name == "puzzleCompletionMonster")
                    puzzleCompletionMonsterIndex = i;
            }
        }

        if (puzzleCompletionMonsterIndex != -1)
        {
            angerFlashlight = gameObject.GetComponent<spt_angerObject>();
            monster = GameObject.Find("MonsterStandin").GetComponent<spt_monsterMotivation>();
            flashlight = gameObject.transform.parent.GetChild(4).GetComponent<Light>();

            timer -= Time.deltaTime; //Decrement timer every frame

            //If the timer runs out and flashlight hasn't been flickering, start flickering
            if (timer < 0 && !flickering && flickerTriggered && !isPosessed)
            {
                timer = Random.Range(.5f, 1.5f);
                flickering = true;
            }

            if (flickering) StartCoroutine("spookyFlicker");

            if (timer < 0 && flickering)
            {
                StopCoroutine("spookyFlicker");
                flashlight.enabled = true;
                timer = Random.Range(minNormalTime, maxNormalTime);
                flickering = false;
            }

            if (monster.isAttacking && !flickerTriggered && !GameObject.FindGameObjectWithTag("Player").GetComponent<spt_NetworkPuzzleLogic>().PuzzleStates[puzzleCompletionMonsterIndex].state)
            {
                if (gameObject.transform.root.GetComponent<NetworkIdentity>().isServer && (monster.whichPlayer == 0))
                {
                    flickerTriggered = true;
                    Invoke("stopFlicker", 1);
                }
                else if (!gameObject.transform.root.GetComponent<NetworkIdentity>().isServer && (monster.whichPlayer == 1))
                {
                    flickerTriggered = true;
                    Invoke("stopFlicker", 1);
                }
            }

            if (isPosessed)
            {
                flashlight.enabled = true;
                flashlight.color = Color.red;
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        movementScript = GameObject.FindObjectOfType(typeof(spt_monsterMovement)) as spt_monsterMovement;
        motivationScript = GameObject.FindObjectOfType(typeof(spt_monsterMotivation)) as spt_monsterMotivation;

        writer = new StreamWriter("DataDump/aiSnapshotDataDump.txt");
        writer.WriteLine("Datetime,Elapsed Time (in Seconds),Current Waypoint,Anger Level");
        InvokeRepeating("snapshot", 1, 1);
    }
Пример #3
0
    void Update()
    {
        //if this isnt' the server, don't do anything.
        if (!isServer) return;
        // If the difficulty or the monster's motivation script has not been obtained yet, do so.
        if (!difficultyFound && (GameObject.Find("DDA").GetComponent<spt_DDAStorage>() != null) && (gameObject.GetComponent<spt_monsterMotivation>() != null))
        {
            difficulty = GameObject.Find("DDA").GetComponent<spt_DDAStorage>().getDiff();
            difficultyFound = true;
            motivationScript = gameObject.GetComponent<spt_monsterMotivation>();
            Debug.Log("DDA has set monster difficulty to: " + difficulty);
        }

        // If the needed components are grabbed, but the difficulty hasn't been set yet, raise/lower the difficulty accordingly.
        else if (!difficultySet && difficultyFound)
        {
            switch (difficulty)
            {
                case 5:
                    raiseTheDifficulty();
                    raiseTheDifficulty();
                    difficultySet = true;
                    return;
                case 4:
                    raiseTheDifficulty();
                    difficultySet = true;
                    return;
                case 3:
                    difficultySet = true;
                    return;
                case 2:
                    lowerTheDifficulty();
                    difficultySet = true;
                    return;
                case 1:
                    lowerTheDifficulty();
                    lowerTheDifficulty();
                    difficultySet = true;
                    return;
                default:
                    break;
            }
        }
    }
 // Update is called once per frame
 void Update()
 {
     if (network == null || monster == null)
     {
         network = GameObject.FindGameObjectWithTag("Player").GetComponent<spt_NetworkPuzzleLogic>();
         monster = GameObject.FindObjectOfType<spt_monsterMotivation>();
     }
     else
     {
         if (network.loaded && network.loaded == true)
         {
             if (!indexInitialized)
             {
                 for (int index = 0; index < network.PuzzleStates.Count; ++index)
                 {
                     if (network.PuzzleStates[index].itemName == gameObject.name)
                     {
                         i = index;
                         indexInitialized = true;
                         break;
                     }
                 }
             }
             else
             {
                 if (network.PuzzleStates[i].state == true && triggered == false)
                 {
                     triggered = true;
                     gameObject.GetComponentInChildren<ParticleSystem>().enableEmission = true;
                     monster.updateAnger(monster.lowerThreshold - monster.angerLevel, gameObject.transform);
                     monster.angerUpdateDisabled = true;
                     Invoke("enableAnger", 1);
                 }
             }
         }
     }
 }
    void Start()
    {
        monster = GameObject.FindObjectOfType<spt_monsterMotivation>();
        manager = GameObject.Find("NetworkManager").GetComponent<NetworkManager>();
        once = false;

        //If a victory light exists, retrieve it's AudioSource and Light components
        if (GameObject.Find("victory_light") != null) {
            transitionA = GameObject.Find("victory_light").GetComponent<AudioSource>();
            winLight = GameObject.Find("victory_light").GetComponent<Light>();
        }
    }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        if (isFlashlight)
            data = new spt_flashlightClass(angerNum);
        else if (isDurationObject)
            data = new spt_durationAngerClass(angerNum);
        else
            data = new spt_baseAngerClass(angerNum);

        monster = GameObject.FindObjectOfType<spt_monsterMotivation>();

        // Performs the "per-tick" calculations needed on actions with a duration (like the flashlight).
        InvokeRepeating("incrementTimer", data.getDuration(), data.getDuration());
    }
    // Update is called once per frame
    void Update()
    {
        if (SceneManager.GetActiveScene().name == "net_SpookyGarage" || SceneManager.GetActiveScene().name == "net_RangerOutpost_crash" || SceneManager.GetActiveScene().name == "net_OpticsLab") musicPlay = true;
        monster = GameObject.FindObjectOfType<spt_monsterMotivation>();
        if (!musicPlay) shutThisBitchDown();
        if (monster != null && musicPlay)
        {
            if (monster.angerLevel >= layerTriggerValue(2)) Fabric.EventManager.Instance.SetParameter("BackgroundMusic", "SecondLayer", 1.0f, null);
            else Fabric.EventManager.Instance.SetParameter("BackgroundMusic", "SecondLayer", 0f, null);

            if (monster.angerLevel >= layerTriggerValue(3)) Fabric.EventManager.Instance.SetParameter("BackgroundMusic", "ThirdLayer", 1.0f, null);
            else Fabric.EventManager.Instance.SetParameter("BackgroundMusic", "ThirdLayer", 0f, null);

            if (monster.angerLevel >= layerTriggerValue(4)) Fabric.EventManager.Instance.SetParameter("BackgroundMusic", "FourthLayer", 1.0f, null);
            else Fabric.EventManager.Instance.SetParameter("BackgroundMusic", "FourthLayer", 0f, null);

            if (monster.angerLevel >= layerTriggerValue(5))
            {
                if (fifthLayerOnce == false)
                {
                    rollTheDieBitch("FifthLayer1", "FifthLayer2");
                    fifthLayerOnce = true;
                }
            }
            else
            {
                fifthLayerOnce = false;
                Fabric.EventManager.Instance.SetParameter("BackgroundMusic", "FifthLayer1", 0f, null);
                Fabric.EventManager.Instance.SetParameter("BackgroundMusic", "FifthLayer2", 0f, null);
            }

            if (monster.angerLevel >= layerTriggerValue(6))
            {
                if (sixthLayerOnce == false)
                {
                    rollTheDieBitch("SixthLayer1", "SixthLayer2");
                    sixthLayerOnce = true;
                }
                else
                {
                    sixthLayerOnce = false;
                    Fabric.EventManager.Instance.SetParameter("BackgroundMusic", "SixthLayer1", 0f, null);
                    Fabric.EventManager.Instance.SetParameter("BackgroundMusic", "SixthLayer2", 0f, null);
                }
            }
        }
    }