Launch projectile
Inheritance: MonoBehaviour
Example #1
0
 public void PassDependencies(IRunnerFactory RunnerFactory, LightScript TestFixture, CommandRunningCallback Callback, ValueWrapper <bool> ShouldCancelRun)
 {
     // if ShouldCancelRun is set to true, the test run will stop
     // RunnerFactory is useful if command is nested and need to get other runners
     // TestFixture can be used to get nested commands
     m_Callback = Callback;
 }
Example #2
0
 public static Script FromLightScript(LightScript lightScript)
 {
     return(new Script(lightScript)
     {
         Name = lightScript.Name, Guid = lightScript.Guid
     });
 }
Example #3
0
 public TestData(IRunnerFactory RunnerFactory, LightScript TestFixture, CommandRunningCallback Callback,
                 bool ShouldCancelRun, bool ShouldFailTest)
 {
     this.RunnerFactory          = RunnerFactory;
     this.TestFixture            = TestFixture;
     this.CommandRunningCallback = Callback;
     this.ShouldCancelRun        = ShouldCancelRun;
     this.ShouldFailTest         = ShouldFailTest;
 }
Example #4
0
 void Awake()
 {
     _rect            = GetComponent <RectTransform>() ?? throw new Exception();
     _image           = GetComponent <Image>() ?? throw new Exception();
     _playerLight     = GameObject.Find("Player/Light").GetComponent <LightScript>() ?? throw new Exception();
     _fullMask        = transform.Find("FullMask").GetComponent <RectTransform>() ?? throw new Exception();
     _full            = transform.Find("Full") ?? throw new Exception();
     _disabledBattery = transform.Find("Disabled") ?? throw new Exception();
     _full.transform.SetParent(_fullMask.transform, true);
 }
    //Turns all lights off
    public void Blackout()
    {
        for (int i = 0; i < AllLights.Count; i++)
        {
            //AllLights[i].gameObject.SetActive(false);

            LightScript l = AllLights[i].GetComponent <LightScript>();
            l.SetIntensity(0);
        }
    }
 public void updateTransperencyByLight(LightScript light, float transperency)
 {
     if (lights.ContainsKey(light))
     {
         lights[light] = transperency;
     }
     else
     {
         lights.Add(light, transperency);
     }
 }
Example #7
0
        public static LightScript Deserialize(TreeNode<YamlObject> tree)
        {
            var commandRoot = new TreeNode<Command>();

            foreach (var yamlCommandNode in tree)
                DeserializeCommandsRecursively(commandRoot, yamlCommandNode);

            var lightScript = new LightScript(commandRoot);
            YamlSerializer.DeserializeSimpleProperties(lightScript, tree);

            return lightScript;
        }
Example #8
0
        public static TreeNode<YamlObject> Serialize(LightScript script, int level = 0)
        {
            var scriptObject = new YamlObject(level, script.GetType().Name, "");
            var tree = new TreeNode<YamlObject>(scriptObject);

            foreach (var n in YamlSerializer.SerializeSimpleProperties(script, level + 1))
                tree.AddChild(n);

            foreach (var node in script.Commands)
                SerializeCommandsRecursively(tree, node, level + 1);

            return tree;
        }
Example #9
0
        public Script(LightScript lightScript)
        {
            Commands = lightScript.Commands;
            m_Name   = lightScript.Name;
            Guid     = lightScript.Guid;

            foreach (var node in Commands.GetAllNodes(false))
            {
                m_CommandGuidMap.AddGuidToMapAndGenerateUniqueIfNeeded(node.value);
            }

            CheckCommandGuidConsistency();
        }
Example #10
0
    void SpawnLights()
    {
        timeSinceLastSpawn = 0.0f;                     // float is used for precision
        timeToSpawn        = Random.Range(0.0f, 1.5f); // random time generated to spawn light

        foreach (Transform b in lights)
        {
            LightScript ls = b.GetComponent <LightScript>();            // getComponent is to retrieve the script for lights
            if (ls && !ls.isActive)
            {
                // if ls is true and is not active, we will activate the light object
                ls.Activate();
                break;
            }
        }
    }
    void Awake()
    {
        // Light
        gameObject.AddComponent<LightScript>();
        gameObject.AddComponent<Light>();
        ls = GetComponent<LightScript>();
        lightSource = GetComponent<Light>();
        ls.enabled = false;
        lightSource.enabled = false;

        // Sound
        audioController = GameObject.FindGameObjectWithTag("AudioController");
        if (!audioController)
        {
            Debug.LogWarning("No audio Controller found. Creating one");
            audioController = new GameObject();
            audioController.name = "AudioController";
            audioController.tag = "AudioController";
        }
        bondAudio = audioController.AddComponent<AudioSource>();
        bondAudio.clip = bondclip;
    }
Example #12
0
    public void FindScript()
    {
        Component tempScript = currentObjects[globalIndex].GetComponent(typeof(MonoBehaviour));

        if (tempScript.GetType().Equals(typeof(TerroristScript)))
        {
            TerroristScript tempTerrorist = (TerroristScript)currentObjects[globalIndex].GetComponent(typeof(TerroristScript));
            tempTerrorist.KillToDeath();
        }
        if (tempScript.GetType().Equals(typeof(JungleCommandoScript)))
        {
            JungleCommandoScript tempJungle = (JungleCommandoScript)currentObjects[globalIndex].GetComponent(typeof(JungleCommandoScript));
            tempJungle.KillToDeath();
        }
        if (tempScript.GetType().Equals(typeof(ZombieScript)))
        {
            ZombieScript tempZombie = (ZombieScript)currentObjects[globalIndex].GetComponent(typeof(ZombieScript));
            tempZombie.KillToDeath();
        }
        if (tempScript.GetType().Equals(typeof(LightScript)))
        {
            LightScript tempLight = (LightScript)currentObjects[globalIndex].GetComponent(typeof(LightScript));
            tempLight.KillToDeath();
        }
        if (tempScript.GetType().Equals(typeof(ArmyScript)))
        {
            ArmyScript tempArmy = (ArmyScript)currentObjects[globalIndex].GetComponent(typeof(ArmyScript));
            tempArmy.KillToDeath();
        }
        if (tempScript.GetType().Equals(typeof(MissileScript)))
        {
            MissileScript tempMissile = (MissileScript)currentObjects[globalIndex].GetComponent(typeof(MissileScript));
            tempMissile.KillToDeath();
        }

        Killed(currentObjects[globalIndex]);
    }
Example #13
0
    private void Awake()
    {
        player = new Controller();

        //Assign light variables to proper objects in scene
        lightSwitch    = GameObject.FindGameObjectWithTag("Lights");
        worldLighting  = GameObject.FindGameObjectWithTag("EnvironmentLights");
        backUpLighting = GameObject.FindGameObjectWithTag("BackUpLights");
        lightScript    = lightSwitch.GetComponent <LightScript>();
        //lightCooldown = 10f;
        lightEnable = true;

        //Assign gramophone variables to proper objects in scene
        gramophone  = GameObject.FindGameObjectWithTag("Gramophone");
        worldMusic  = GameObject.FindGameObjectWithTag("WorldMusic");
        musicScript = gramophone.GetComponent <GramophoneScript>();
        //musicCooldown = 10f;
        musicEnable = true;

        //Assign painting variables to proper objects in scene
        painting    = GameObject.FindGameObjectWithTag("Painting");
        paintScript = painting.GetComponent <PaintingScript>();
        //paintCooldown = 15f;
        paintEnable = true;

        prop       = GameObject.FindGameObjectWithTag("Prop");
        propScript = prop.GetComponent <PropScript>();

        //Assign player numbers and colors
        playernum = numplayers;
        numplayers++;

        //Add by Guanchen Liu
        //Assign nathan
        Nathan      = GameObject.Find("Nathan");
        humanScript = Nathan.GetComponent <HumanBehavior>();
        currentItem = selectedItem.None;
        currentCond = ghostCond.None;
        mainCamera  = GameObject.Find("MainCamera");
        sc          = mainCamera.GetComponent <CameraControl>();
        UI          = UIManager.instance.gameObject;
        var UICoolDown = UI.transform.Find("CoolDown").gameObject;

        // lightImage = UICoolDown.transform.GetChild(0).GetComponent<Image>();
        // musicImage = UICoolDown.transform.GetChild(1).GetComponent<Image>();
        // paintImage = UICoolDown.transform.GetChild(2).GetComponent<Image>();


        player.Gameplay.Grabbing.canceled += context => ReleaseObject();

        if (playernum == 0)
        {
            GameObject temp = GameObject.Find("Ghost_1");
            transform.position = temp.transform.position;
            Destroy(temp);
            mesh.material   = color1;
            gameObject.name = "Ghost_1";
        }
        if (playernum == 1)
        {
            GameObject temp = GameObject.Find("Ghost_2");
            transform.position = temp.transform.position;
            Destroy(temp);
            mesh.material   = color2;
            gameObject.name = "Ghost_2";
            backUpLighting.gameObject.SetActive(false);
            var UIScript = UI.GetComponent <UIManager>();
            Time.timeScale = 1.0f;
            UIScript.playStartImage();
        }

        var allGhost = GameObject.FindGameObjectsWithTag("Ghost");

        choreManger = GameObject.Find("ChoreManger").GetComponent <ChoreManger>();
    }
Example #14
0
    private void Start()
    {
        mesh = gameObject.GetComponent <MeshRenderer>();

        lux = GetComponentInChildren <LightScript>();
    }
        public static void RunScript(LightScript script)
        {
            // Check if lights are already running
            if (ScriptControl.CurrentLightStatus != LightStatus.IDLE)
            {
                Logger.Log("Unable to run script, sequence active.");
                return;
            }

            ResetStopLightState();

            switch (script)
            {
            case LightScript.BREAK1:
                Scripts.BREAK1 break1       = new Scripts.BREAK1();
                Thread         break1Thread = new Thread(break1.StartSequence);
                break1Thread.Start();
                break;

            case LightScript.BREAK2:
                Scripts.BREAK2 break2       = new Scripts.BREAK2();
                Thread         break2Thread = new Thread(break2.StartSequence);
                break2Thread.Start();
                break;

            case LightScript.BREAK3:
                SoundManager.StartSound(SoundManager.AudioFile.BREAK3);
                Scripts.BREAK3 break3       = new Scripts.BREAK3();
                Thread         break3Thread = new Thread(break3.StartSequence);
                break3Thread.Start();
                break;

            case LightScript.FINAL1:
                Scripts.FINAL1 final1       = new Scripts.FINAL1();
                Thread         final1Thread = new Thread(final1.StartSequence);
                final1Thread.Start();
                break;

            case LightScript.FINAL2:
                Scripts.FINAL2 final2       = new Scripts.FINAL2();
                Thread         final2Thread = new Thread(final2.StartSequence);
                final2Thread.Start();
                break;

            case LightScript.FINAL3:
                Scripts.FINAL3 final3       = new Scripts.FINAL3();
                Thread         final3Thread = new Thread(final3.StartSequence);
                final3Thread.Start();
                break;

            case LightScript.TRIPLE:
                SoundManager.StartSound(SoundManager.AudioFile.TRIPLE);
                Scripts.TRIPLE triple       = new Scripts.TRIPLE();
                Thread         tripleThread = new Thread(triple.StartSequence);
                tripleThread.Start();
                break;

            case LightScript.MILLIONARE:
                SoundManager.StartSound(SoundManager.AudioFile.MILLIONAIRE);
                Scripts.MILLIONARE millionare       = new Scripts.MILLIONARE();
                Thread             millionareThread = new Thread(millionare.StartSequence);
                millionareThread.Start();
                break;

            case LightScript.XFILES:
                SoundManager.StartSound(SoundManager.AudioFile.XFILES);
                Scripts.XFILES xfiles       = new Scripts.XFILES();
                Thread         xfilesThread = new Thread(xfiles.StartSequence);
                xfilesThread.Start();
                break;

            case LightScript.TRANCE:
                SoundManager.StartSound(SoundManager.AudioFile.TRANCE);
                Scripts.TRANCE trance       = new Scripts.TRANCE();
                Thread         tranceThread = new Thread(trance.StartSequence);
                tranceThread.Start();
                break;

            case LightScript.YOUSUCK:
                SoundManager.StartSound(SoundManager.AudioFile.SUCK);
                Scripts.YOUSUCK yousuck       = new Scripts.YOUSUCK();
                Thread          yousuckThread = new Thread(yousuck.StartSequence);
                yousuckThread.Start();
                break;

            case LightScript.SCRATCH:
                SoundManager.StartSound(SoundManager.AudioFile.SCRATCH);
                Scripts.SCRATCH scratch       = new Scripts.SCRATCH();
                Thread          scratchThread = new Thread(scratch.StartSequence);
                scratchThread.Start();
                break;

            case LightScript.FRONTR:
                Scripts.FRONTR frontr       = new Scripts.FRONTR();
                Thread         frontrThread = new Thread(frontr.StartSequence);
                frontrThread.Start();
                break;

            case LightScript.FRONTL:
                Scripts.FRONTL frontl       = new Scripts.FRONTL();
                Thread         frontlThread = new Thread(frontl.StartSequence);
                frontlThread.Start();
                break;

            case LightScript.MIDDLER:
                Scripts.MIDDLER middler       = new Scripts.MIDDLER();
                Thread          middlerThread = new Thread(middler.StartSequence);
                middlerThread.Start();
                break;

            case LightScript.MIDDLEL:
                Scripts.MIDDLEL middlel       = new Scripts.MIDDLEL();
                Thread          middlelThread = new Thread(middlel.StartSequence);
                middlelThread.Start();
                break;

            case LightScript.BACKR:
                Scripts.BACKR backr       = new Scripts.BACKR();
                Thread        backrThread = new Thread(backr.StartSequence);
                backrThread.Start();
                break;

            case LightScript.BACKL:
                Scripts.BACKL backl       = new Scripts.BACKL();
                Thread        backlThread = new Thread(backl.StartSequence);
                backlThread.Start();
                break;

            case LightScript.AIRHORN:
                SoundManager.StartSound(SoundManager.AudioFile.AIRHORN);
                Scripts.AIRHORN airhorn       = new Scripts.AIRHORN();
                Thread          airhornThread = new Thread(airhorn.StartSequence);
                airhornThread.Start();
                break;

            case LightScript.SUSPENSE:
                SoundManager.StartSound(SoundManager.AudioFile.SUSPENSE);
                Scripts.SUSPENSE suspense       = new Scripts.SUSPENSE();
                Thread           suspenseThread = new Thread(suspense.StartSequence);
                suspenseThread.Start();
                break;

            case LightScript.USA:
                SoundManager.StartSound(SoundManager.AudioFile.USA);
                Scripts.USA usa       = new Scripts.USA();
                Thread      usaThread = new Thread(usa.StartSequence);
                usaThread.Start();
                break;

            default:
                Logger.Log("Requested script not mapped: " + script.ToString());
                break;
            }
        }
Example #16
0
 public void removeLight(LightScript light)
 {
     lights.Remove(light);
 }
 // Use this for initialization
 void Start()
 {
     instance = this;
     init();
 }
Example #18
0
 public GameAnalytics()
 {
     _player = GameObject.Find("Player").GetComponent <PlayerMovement>() ?? throw new Exception();
     _light  = _player.transform.Find("Light").GetComponent <LightScript>() ?? throw new Exception();
 }
Example #19
0
 public void Add(LightScript _Lights)
 {
     //Adds Light to LightScript List
     Lights.Add(_Lights);
 }
Example #20
0
    void Awake()
    {
		Instance = this;

		mainLight = GetComponent<Light>();
    }
Example #21
0
 private void Start()
 {
     LS          = GetComponent <LightScript>();
     avatarLight = GetComponent <Light>();
 }
Example #22
0
 // Start is called before the first frame update
 void Start()
 {
     parentmesh = GetComponentInParent <LightScript>();
 }
 void OnEnable()
 {
     _target = (LightScript) target;
     _target.Start();
 }