Example #1
0
    public void OnStart()
    {
        myZone = gameObject.RequireComponent <CZone>();
        //mySound.AddSound("RadioStatic.vente");
        //mySound.AddSound("BeginOutro.vente");
        //mySound.AddSound("Heartbeat.vente");
        //mySound.Loop(true, "static.vente");
        mySound = gameObject.RequireComponent <CSound>();
        //mySound.PlayIndependentEvent("static.vente");

        smc                = new StateMachineController();
        unactive           = new State(smc, null, State_unactive_Update, null);
        lightson           = new State(smc, State_lightson_Start, State_lightson_Update, null, _lightson[0]);
        lightsoff          = new State(smc, State_lightsoff_Start, null, null, 1.0f, lightson);
        finished           = new State(smc);
        finale             = new State(smc, State_finale_Start, null, State_finale_End, 5.0f, finished);
        lightsonwait       = new State(smc, null, null, null, 1.0f, lightsoff);
        lightson.NextState = lightson;
        smc.SetState(unactive);

        foreach (GameObject g in GameObject.GetGameObjectsWithTag("TLight"))
        {
            lights.Add(g.RequireComponent <CLight>());
            g.RequireComponent <CSound>(); //.AddSound("LightTurnOn.vente");
        }
        foreach (CLight l in lights)
        {
            l.setEnabled(false);
        }
    }
Example #2
0
 static bool LoadZonesFromFile(string filename)
 {
     try {
         string[] file = File.ReadAllLines(filename);
         int      z;
         for (z = 0; z *6 + 5 < file.Length; z++)
         {
             CPoint3d[] points = new CPoint3d[5];
             for (int p = 0; p < 5; p++)
             {
                 points[p] = new CPoint3d();
                 string[] pos = file[z * 6 + p + 1].Split(' ');
                 points[p].X = float.Parse(pos[0]);
                 points[p].Y = float.Parse(pos[1]);
                 points[p].Z = float.Parse(pos[2]);
             }
             _zones.Zones[z] = CZone.CreateBaseZoneXY(points[0], points[1], points[2], points[3], points[4].Z, points[4].X, points[4].Y);
         }
         _zones.NbZoneActive = z;
         _jaco.ConfigurationsManager.SetProtectionZones(_zones);
         Console.WriteLine(_info + "Read zone configuration from file \"" + filename + "\".");
         Console.WriteLine(_info + "You will need to reboot the robot for changes to take effect.");
         PrintZones();
         return(true);
     } catch (Exception) {
         Console.WriteLine(_error + "Could not read zone configuration from file \"" + filename + "\".");
     }
     return(false);
 }
    public void OnStart()
    {
        rand   = new Random();
        myZone = gameObject.RequireComponent <CZone>();
        //mySound.AddSound("RadioStatic.vente");
        //mySound.AddSound("BeginOutro.vente");
        //mySound.AddSound("Heartbeat.vente");
        //mySound.Loop(true, "static.vente");
        mySound = gameObject.RequireComponent <CSound>();
        //mySound.PlayIndependentEvent("static.vente");

        smc                = new StateMachineController();
        unactive           = new State(smc, null, State_unactive_Update, null);
        lightson           = new State(smc, State_lightson_Start, State_lightson_Update, null, 1.0f);
        lightsoff          = new State(smc, State_lightsoff_Start, null, null, 1.0f, lightson);
        lightsonwait       = new State(smc, null, null, null, 1.0f, lightsoff);
        lightson.NextState = lightson;
        smc.SetState(unactive);

        foreach (GameObject g in GameObject.GetGameObjectsWithTag("TLight"))
        {
            lights.Add(g.RequireComponent <CLight>());
            g.RequireComponent <CSound>(); //.AddSound("LightTurnOn.vente");
        }
        foreach (GameObject g in GameObject.GetGameObjectsWithTag("FlickerLight"))
        {
            GetScriptClass <LightFlicker>(g).activated = true;
        }

        MonsterEncounter1 me = GetScript <MonsterEncounter1>(GameObject.GetGameObjectByName("Monster1"));

        me.gameObject.RequireComponent <CMeshRenderer>().setEnabled(false);
    }
Example #4
0
 public void OnStart()
 {
     zone   = GameObject.GetGameObjectByName("scp_zone").RequireComponent <CZone>();
     rand   = new Random();
     target = null;
     speed  = new Vector3(.3f, .8f, -.5f);
     sound  = gameObject.RequireComponent <CSound>();
     fx     = GameObject.GetGameObjectByName("Camera").RequireComponent <CArtifactFX>();
     sound.PlayIndependentEvent("CREATURE_CLOSE.vente", true, 1);
 }
Example #5
0
    float changeY;             //slope of forward vector

    public void OnStart()
    {
        velocity         = new Vector3();
        acquiredVelocity = new Vector3();
        GameObject Plane = GameObject.GetGameObjectByName("Plane");

        paperViewer = GetScript <PaperViewer>(Plane);
        gameObject.SetFlag("Paper");
        zone     = GameObject.GetGameObjectByName("PaperZone").RequireComponent <CZone>();
        initialY = gameObject.transform.position.y;
        initialZ = gameObject.transform.position.z;
        Vector3 up = gameObject.transform.GetUpVector().Negate();

        changeY = up.Y / up.Z;
    }
Example #6
0
    /*
     * ELEVATOR ROOT (THIS OBJ) MUST BE ON THE FLOOR OF THE ELEVATOR FOR THIS TO WORK
     */

    public void OnStart()
    {
        //dependencies
        doors = GetScriptsInChildren <DoorMain>(gameObject);

        idle          = new State(smc);
        idle.OnEnter  = State_Idle_Enter;
        idle.OnUpdate = State_Idle_Update;
        idle.OnExit   = State_Idle_Exit;

        done          = new State(smc);
        done.OnUpdate = State_done_Update;

        moving                = new State(smc);
        moving.OnEnter        = State_Moving_Enter;
        moving.OnUpdate       = State_Moving_Update;
        moving.OnExit         = State_Moving_Exit;
        moving.MaxTimeInState = moveTime;
        moving.NextState      = done;

        returning                = new State(smc);
        returning.OnEnter        = State_returning_Enter;
        returning.OnUpdate       = State_returning_Update;
        returning.OnExit         = State_returning_Exit;
        returning.MaxTimeInState = moveTime;
        returning.NextState      = idle;

        beginMoving = new State(smc, null, State_beginMoving_Update, null);

        player       = Common.GetStealthPlayer();
        playerScript = Common.GetStealthPlayerScript();

        elevatorZone = gameObject.RequireComponent <CZone>();
        sound_       = gameObject.RequireComponent <CSound>();
        //sound_.AddSound("Elevator Start.vente");
        //sound_.AddSound("Elevator Stop.vente");

        smc.SetState(idle);
        timer  = 0;
        startY = gameObject.transform.position.y;
        endY   = startY + endY;
    }