Наследование: MonoBehaviour
Пример #1
0
    private void Awake()
    {
        if (enabled)
        {
            _fadeToBlackImage.enabled = true;
            _fadeToBlackImage.color   = Color.black;

            _bottomPanel.SetActive(true);

            _debugGUI = FindObjectOfType <OceanDebugGUI>();
            if (_debugGUI)
            {
                _showGUI                  = _debugGUI._guiVisible;
                _showTargets              = _debugGUI._showSimTargets;
                _debugGUI._guiVisible     = false;
                _debugGUI._showSimTargets = false;
            }

            camController = GetComponent <CamController>();
            if (camController)
            {
                camController.enabled = false;
            }
        }

        LoadEnvScene();
    }
Пример #2
0
    void Awake()
    {
        mainCamera.enabled = false;
        Camera.SetupCurrent(mainCamera);

        GameObject cameraCtrlGO = Instantiate(exResources.GetResource(ResourceType.OTHER, "CamController")) as GameObject;

        cameraCtrlGO.name = "CameraCtrl 0";
        if (cameraCtrlGO)
        {
            currentCtrl = cameraCtrlGO.GetComponent <CamController>();
            cameraCtrlGO.SetActive(true);
            GameObject.DontDestroyOnLoad(cameraCtrlGO);
        }
        cameraCtrlGO      = Instantiate(exResources.GetResource(ResourceType.OTHER, "CamController")) as GameObject;
        cameraCtrlGO.name = "CameraCtrl 1";
        if (cameraCtrlGO)
        {
            nextCtrl = cameraCtrlGO.GetComponent <CamController>();
            cameraCtrlGO.SetActive(false);
            GameObject.DontDestroyOnLoad(cameraCtrlGO);
        }

        if (mapCamera == null)
        {
            GameObject obj = GameObject.Find("MapCamera");
            if (obj != null)
            {
                mapCamera = obj.GetComponent <Camera>();
            }
        }
    }
Пример #3
0
    /// <summary>
    /// Provide controls for calling CamController functions
    /// </summary>
    void CameraControlsWindow(int windowID)
    {
        float lw = 200f;

        // camera perspective controls
        GUILayout.BeginHorizontal(GUILayout.Width(UI_Toolbar.I.innerWidth));
        GUILayout.Label("Camera Perspective: ", GUILayout.Width(lw));
        if (GUILayout.Button(CamController.viewMode.ToString()))
        {
            CamController.CycleViewMode();
        }
        GUILayout.EndHorizontal();

        // camera render mode controls
        GUILayout.BeginHorizontal(GUILayout.Width(UI_Toolbar.I.innerWidth));
        GUILayout.Label("Render Mode: ", GUILayout.Width(lw));
        if (GUILayout.Button(CamController.renderMode.ToString()))
        {
            CamController.CycleRenderMode();
        }
        GUILayout.EndHorizontal();

        // camera areas of interest
        GUILayout.BeginHorizontal(GUILayout.Width(UI_Toolbar.I.innerWidth));
        GUILayout.Label("Observing: ", GUILayout.Width(lw));
        if (GUILayout.Button(CamController.area.name))
        {
            CamController.CycleAreaOfInterest();
        }
        GUILayout.EndHorizontal();
    }
Пример #4
0
 /// <summary>
 /// Exit BotNavSim.state behaviour: remove environment, clear paths
 /// </summary>
 public static void Exit()
 {
     CamController.ClearAreaList();
     CamController.ClearViewModeList();
     environment.transform.Recycle();
     paths.Clear();
 }
Пример #5
0
 public void SwitchTo(SolarOrbit now)
 {
     curPlanet = now;
     cam.SetPlanetTarget(curPlanet.transform);
     cam.camRot.x = CamController.VYAngle(Vector3.zero, curPlanet.transform.position);
     enabled      = true;
 }
Пример #6
0
 private void Awake()
 {
     Scene.ActiveMB           = this;
     Scene.GameStats          = this._gameStats;
     Scene.SceneTracker       = this._sceneTracker;
     Scene.MutantControler    = this._mutantControler;
     Scene.MutantSpawnManager = this._mutantSpawnManager;
     Scene.Yacht            = this._yacht;
     Scene.PlaneCrash       = this._plane;
     Scene.PlaneCrashAnimGO = this._planeCrashAnimGO;
     Scene.TriggerCutScene  = this._triggerCutScene;
     Scene.RainFollowGO     = this._rainFollowGO;
     Scene.RainTypes        = this._rainTypes;
     Scene.WeatherSystem    = this._weatherSystem;
     Scene.HudGui           = this._hudGui;
     Scene.Cams             = this._cams;
     Scene.Clock            = this._clock;
     Scene.Atmosphere       = this._atmos;
     Scene.WorkScheduler    = this._workScheduler;
     Scene.LoadSave         = this._loadSave;
     Scene.PlaneGreebles    = this._planeGreebles;
     Scene.OceanFlat        = this._oceanFlat;
     Scene.OceanCeto        = this._oceanCeto;
     Scene.ShoreMask        = this._shoreMask;
     Scene.SinkHoleCenter   = this._sinkHoleCenter;
     Scene.CaveGrounds      = this._caveGrounds;
 }
Пример #7
0
 private void OnDestroy()
 {
     Scene.ActiveMB           = null;
     Scene.GameStats          = null;
     Scene.SceneTracker       = null;
     Scene.MutantControler    = null;
     Scene.MutantSpawnManager = null;
     Scene.Yacht            = null;
     Scene.PlaneCrash       = null;
     Scene.PlaneCrashAnimGO = null;
     Scene.TriggerCutScene  = null;
     Scene.RainFollowGO     = null;
     Scene.RainTypes        = null;
     Scene.WeatherSystem    = null;
     Scene.HudGui           = null;
     Scene.Cams             = null;
     Scene.Clock            = null;
     Scene.Atmosphere       = null;
     Scene.WorkScheduler    = null;
     Scene.LoadSave         = null;
     Scene.PlaneGreebles    = null;
     Scene.OceanFlat        = null;
     Scene.OceanCeto        = null;
     Scene.ShoreMask        = null;
     Scene.SinkHoleCenter   = null;
     Scene.CaveGrounds      = null;
 }
Пример #8
0
    public void CreateCubeObj()
    {
        if (objects.Count != 0)
        {
            objects[dataIndex].active = false;
        }
        GameObject tmp    = new GameObject("tmp" + datas.Count);
        GameObject tmpCam = GameObject.Instantiate(camPrefab);

        tmpCam.transform.parent = tmp.transform;
        CamController tmpCtl = tmpCam.GetComponent <CamController>();

        tmpCtl.Target = tmp;
        Curve tmpCurve = tmp.AddComponent <Curve>();

        tmpCurve.Initialize(cPointPrefab);
        objectCurves.Add(tmpCurve);
        objects.Add(tmp);
        dataIndex = datas.Count - 1;
        tmp.transform.position = Vector3.zero;
        CreateCubeObjSub(datas[datas.Count - 1].joint, tmp.transform.position, tmp);
        if (dataIndex != 0)
        {
            SetObjectActive(dataIndex - 1, false);
        }
        SetObjectActive(dataIndex, true);
    }
Пример #9
0
 void OnEnable()
 {
     //   lookupPanel.SetActive (true);
     cam.SetPlanetTarget(curMoon.transform);
     cam.SetCamDistance(curMoon, false);
     cam.lockTarget = curMoon.transform.parent;
     cam.camRot.x   = CamController.VYAngle(Vector3.zero, curMoon.transform.position) - 90;
 }
Пример #10
0
 /// <summary>
 /// Adds a path to paths list.
 /// </summary>
 /// <param name="path">Path.</param>
 public static void AddPath(BotPath path)
 {
     if (!paths.Contains(path))
     {
         paths.Add(path);
     }
     CamController.AddAreaOfInterest(path);
 }
Пример #11
0
    /* ### Static Methods ### */

    /// <summary>
    /// Enter this instance.
    /// </summary>
    public static void Enter()
    {
        CamController.AddViewMode(CamController.ViewMode.Birdseye);
        CamController.AddViewMode(CamController.ViewMode.FreeMovement);
        CamController.AddViewMode(CamController.ViewMode.Mounted);
        CamController.AddViewMode(CamController.ViewMode.Orbit);
        CamController.AddAreaOfInterest(testArea);
    }
Пример #12
0
 // Use this for initialization
 void Start()
 {
     seaPartOverTimeSprint.Stop();
     cam           = Camera.main;
     camController = cam.GetComponent <CamController>();
     rb            = GetComponent <Rigidbody>();
     pc            = GetComponent <PlayerController> ();
     usedStep      = groundStep;
 }
Пример #13
0
    private void Start()
    {
        myLabel.gameObject.GetComponent <MeshRenderer>().sortingLayerName = "Default";
        myLabel.gameObject.GetComponent <MeshRenderer>().sortingOrder     = 5;

        CC           = GameObject.Find("Main Camera").GetComponent <CamController>();
        GC           = GameObject.Find("GameController").GetComponent <GameController>();
        myLabel.text = "";
    }
Пример #14
0
    /// <summary>
    /// GUI window function: Display controls for loaded CSV files.
    /// </summary>
    private void Legend(int windowID)
    {
        // back button
        GUILayout.BeginHorizontal(GUILayout.Width(UI_Toolbar.I.innerWidth));
        if (GUILayout.Button("<", GUILayout.Width(30f)))
        {
            hidden = true;
        }
        if (GUILayout.Button("Load from CSV..."))
        {
            _windows.Push(CsvBrowser);
        }
        GUILayout.EndHorizontal();

        if (LogLoader.paths.Count < 1)
        {
            GUILayout.Label("No paths loaded.");
        }

        // list botpaths
        Color c = GUI.contentColor;

        for (int i = 0; i < LogLoader.paths.Count; i++)
        {
            GUILayout.BeginHorizontal();
            GUI.contentColor = LogLoader.paths[i].color;
            if (GUILayout.Button(LogLoader.paths[i].csvName))
            {
                LogLoader.paths[i].visible = !LogLoader.paths[i].visible;
                continue;
            }
            // highlight path if mouseover button
            // this event appears to be broken
            if (IsMouseOver())
            {
                LogLoader.paths[i].highlight = true;
            }
            else
            {
                LogLoader.paths[i].highlight = false;
            }
            // observe button
            if (GUILayout.Button("O"))
            {
                CamController.SetAreaOfInterest(LogLoader.paths[i]);
            }
            // unload path button
            if (GUILayout.Button("X"))
            {
                LogLoader.RemovePath(LogLoader.paths[i]);
            }
            GUILayout.EndHorizontal();
        }
        // reset content color
        GUI.contentColor = c;
    }
Пример #15
0
    void Start()
    {
        mainCamera = GameObject.Find("Main Camera").GetComponent <CamController>();
        player     = GameObject.Find("edgarMCSkin");
        playerMove = player.GetComponent <BasicMovement>();
        rigidBody  = GetComponent <Rigidbody>();

        SetWheels();
        SetChasis();
    }
Пример #16
0
    void Start()
    {
        camCon = Camera.main.GetComponent <CamController> ();

        planetList = Planet.planetList;

        auxOrbit = GameObject.Find("AuxOrbit").GetComponent <AuxOrbit> ();

        messageQueue.Enqueue(initialMessage);
        messageQueue.Enqueue(secondMessage);
        messageQueue.Enqueue(thirdMessage);
    }
	void Start ()
	{
		camCon = Camera.main.GetComponent<CamController> ();

		planetList = Planet.planetList;

		auxOrbit = GameObject.Find ("AuxOrbit").GetComponent<AuxOrbit> ();

		messageQueue.Enqueue (initialMessage);
		messageQueue.Enqueue (secondMessage);
		messageQueue.Enqueue (thirdMessage);
	}
Пример #18
0
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(gameObject);
     }
     instance  = this;
     cam       = GetComponent <Camera>();
     camPlanes = GeometryUtility.CalculateFrustumPlanes(cam);
     group     = groupCam.GetComponent <CinemachineTargetGroup>();
     player.OnPlayerChangePlanet += ChangeCam;
     mainCamNoise  = mainCam.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>();
     groupCamNoise = groupCam.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>();
 }
Пример #19
0
    /// <summary>
    /// Points the cam to spawn.
    /// </summary>
    private void pointCamToSpawn()
    {
        var cam = GetComponentInChildren <Camera> ();

        if (cam != null)
        {
            cam.transform.parent = null;
            CamController cc = cam.GetComponent <CamController> ();
            if (cc != null)
            {
                cc.startPoint    = this.transform.position;
                cc.inTransistion = true;
            }
        }
    }
Пример #20
0
    protected void StopCrossFade()
    {
        if (crossFading)
        {
            fadeTimer   = fadeDuration;
            crossFading = false;
            CamController tmp = currentCtrl;
            currentCtrl = nextCtrl;
            nextCtrl    = tmp;

            nextCtrl.gameObject.SetActive(false);

            curCamPosition = currentCtrl.transform.position;
            curCamRotation = currentCtrl.transform.rotation;
            BlackCoverAll(false);
        }
    }
    void Start()
    {
        mainCamera         = GameObject.Find("Main Camera").GetComponent <CamController>();
        charController     = GetComponent <CharacterController>();
        discCastHeight     = charController.height * discCastHeightFraction;
        discCastNum        = discCastNum % 2 == 0 ? discCastNum / 2 : (discCastNum + 1) / 2;
        discRaysDirections = new Vector3[discCastNum];
        discCastOrigin     = transform.position + (Vector3.up * discCastHeight);

        float degreeDif = (180 / discCastNum) * Mathf.Deg2Rad;
        float angle     = 0;

        for (uint a = 0; a < discCastNum; a++)
        {
            angle = a * degreeDif;
            discRaysDirections[a] = new Vector3(Mathf.Sin(angle), 0, Mathf.Cos(angle));
        }
    }
Пример #22
0
    /// <summary>
    /// Loads the environment.
    /// </summary>
    /// <param name="name">Name.</param>
    private static void LoadEnvironment(string name)
    {
        EnvLoader.SearchForEnvironments();
        if (environment)
        {
            environment.transform.Recycle();
        }
        environment      = EnvLoader.LoadEnvironment(name);
        environment.name = name;         // avoids: Unity appending "(Clone)" to instance names
        Debug.Log(environment);
        Bounds b = new Bounds();

        foreach (Renderer r in environment.GetComponentsInChildren <Renderer>())
        {
            b.Encapsulate(r.bounds);
        }
        Instance.bounds = b;
        CamController.SetViewMode(CamController.ViewMode.Birdseye);
    }
Пример #23
0
 /// <summary>
 /// Exit simulation.
 /// </summary>
 public static void Exit()
 {
     Debug.Log("Simulation Exit.");
     Instance.StopAllCoroutines();
     settings = null;
     if (Log.logging)
     {
         Log.Stop(StopCode.Unspecified);
     }
     if (robot)
     {
         robot.Recycle();
     }
     if (environment)
     {
         environment.transform.Recycle();
     }
     CamController.ClearAreaList();
     CamController.ClearViewModeList();
     state = State.inactive;
 }
Пример #24
0
    void Awake()
    {
        if (mainCamera != null && mainCamera != this)
        {
            Debug.LogWarning("Replacing main camera!");
        }

        mainCamera = this;

        if (onCamSwitch != null)
        {
            onCamSwitch();
        }

        SetColors();

        GameManager.Instance.ProgressChanged += () => {
            Debug.Log("Updating camera colors...");
            SetColors();
        };
    }
Пример #25
0
 /// <summary>
 /// Halt current simulation.
 /// Load the next simulation in batch, or
 ///  change state to State.end if at the end of batch.
 /// </summary>
 public static void NextSimulation()
 {
     // stop current simulation
     if (state == State.simulating)
     {
         Halt(StopCode.Unspecified);
     }
     // next in batch
     simulationNumber++;
     if (simulationNumber > batch.Count)
     {
         // end of batch
         Halt(StopCode.Unspecified);
         End();
         return;
     }
     Debug.Log("Simulation NextSimulation: " + simulationNumber + " of " + batch.Count);
     // load simulation settings
     settings = batch[simulationNumber - 1];
     Log.Settings();
     // load environment
     EnvLoader.SearchForEnvironments();
     environment = EnvLoader.LoadEnvironment(settings.environmentName);
     destination.transform.position = RandomInBounds(Instance.bounds);
     // load robot
     if (robot)
     {
         CamController.RemoveAreaOfInterest(robot);
     }
     BotLoader.SearchForRobots();
     robot            = BotLoader.LoadRobot(settings.robotName);
     robot.navigation = NavLoader.LoadPlugin(settings.navigationAssemblyName);
     // configure camera
     CamController.AddAreaOfInterest(robot);
     CamController.SetViewMode(CamController.ViewMode.Birdseye);
     CamController.SetAreaOfInterest(robot);
     // reset test number
     testNumber = 0;
     NextTest();
 }
Пример #26
0
        public override void Update(GameSettings settings)
        {
            PointFloat vel  = GetVelocity();
            float      rotV = GetRotationVelocity();

            rotV = rotV - (rotV / 50);
            if (ControlKeys.IsKeyDown("s"))
            {
                vel = MoveBackward(vel);
            }
            if (ControlKeys.IsKeyDown("w"))
            {
                vel = MoveForward(vel);
                //Console.WriteLine(GetPosition().x + " " + GetPosition().y);
            }

            if (ControlKeys.IsKeyDown("d"))
            {
                rotV = rotV + (0.05f - rotV);
            }
            if (ControlKeys.IsKeyDown("a"))
            {
                rotV = rotV + (-0.05f - rotV);
            }
            if (ControlKeys.IsKeyDown("e"))
            {
                gun.SetPos(Helpers.PhysicsAndPositions.OffsetPosition(GetPosition(), 2.0f, GetRotation() + (float)Math.PI * 0.5f));
                gun.SetRot(GetRotation());
                gun.SetSpread(Helpers.PhysicsAndPositions.PI * 2);
                gun.SetLifeTime(100, 200);
                gun.Blow(1f, 100, false);
            }
            SetVelocity(vel);
            SetRotationVelocity(rotV);
            base.Update(settings);
            engineFirePar.SetPos(Helpers.PhysicsAndPositions.OffsetPosition(GetPosition(), 1.0f, GetRotation() + (float)Math.PI * 1.5f));
            engineFirePar.SetRot(GetRotation() + 3.14f);
            CamController.SetPos(GetPosition());
        }
Пример #27
0
    void LateUpdate()
    {
        if (crossFading)
        {
            fadeTimer += Time.deltaTime;
            float ratio = fadeTimer / fadeDuration;
            ratio          = exEase.Smooth(ratio);
            curCamPosition = Vector3.Lerp(srcCamPosition,
                                          nextCtrl.transform.position,
                                          ratio);
            curCamRotation = Quaternion.Slerp(srcCamRotation,
                                              nextCtrl.transform.rotation,
                                              ratio);
            if (fadeTimer >= fadeDuration)
            {
                crossFading = false;
                CamController tmp = currentCtrl;
                currentCtrl = nextCtrl;
                nextCtrl    = tmp;

                nextCtrl.gameObject.SetActive(false);

                curCamPosition = currentCtrl.transform.position;
                curCamRotation = currentCtrl.transform.rotation;
                BlackCoverAll(false);
            }
        }
        else
        {
            if (currentCtrl != null && currentCtrl.gameObject.activeSelf)
            {
                curCamPosition = currentCtrl.transform.position;
                curCamRotation = currentCtrl.transform.rotation;
            }
        }

        mainCamera.transform.position = curCamPosition;
        mainCamera.transform.rotation = curCamRotation;
    }
Пример #28
0
    void Awake()
    {
        if (mainCamera != null && mainCamera != this)
        {
            Debug.LogWarning("Replacing main camera!");
        }

        mainCamera = this;

        if (onCamSwitch != null)
        {
            onCamSwitch();
        }

        var factors = palettes[GameManager.Instance.Progress];

        var postFX = GetComponent <ColorPostFX>();

        postFX.fac1 = factors[0];
        postFX.fac2 = factors[1];
        postFX.fac3 = factors[2];
        postFX.gray = grays[GameManager.Instance.Progress];
    }
Пример #29
0
    ///<summary>Initializing system varables.</summary>
    public void Academy_Initialize()
    {
        print("Initializing Game System");
        levelData = Resources.Load("Level data") as LevelData;
        //double the grid size so it's always even
        gridSize   = levelData.gridSize * 2;
        gridCenter = GameObject.FindObjectOfType <EnemyArmy>().gameObject.transform.position;
        //get the grid center by taking the opposite of the the enemy army position
        gridCenter = new Vector3(-gridCenter.x, gridCenter.y, gridCenter.z);

        //if the level exists, show some level info, else load the end screen
        if (PlayerPrefs.GetInt("level") >= levelData.levels.Count)
        {
            Debug.LogError("Invalid level data, Load default level - " + PlayerPrefs.GetInt("level"));
            PlayerPrefs.SetInt("level", 0);
        }
        else
        {
            levelInfo.text = "Level " + (PlayerPrefs.GetInt("level") + 1) + " - " + levelData.levels[PlayerPrefs.GetInt("level")].scene;
        }
        characterStats = true;
        switchPanelContent(false);
        characterStatsPanel.SetActive(false);
        //enables minimap
        topDownMapPanel.SetActive(true);
        leftPanelAnimator.SetBool("hide instant", true);

        EmptyUnit = new GameObject();
        EmptyUnit.transform.parent = this.gameObject.transform;
        inspector     = new UnitInspect(this);
        cam           = FindObjectOfType <CamController>();
        inspector.cam = cam;
        DebugInner    = new DebugInfo(inspector);
        AcademyInner  = FindObjectOfType <MyAcademy>();
        area          = FindObjectOfType <WalkArea>();
    }
Пример #30
0
 private void Awake()
 {
     Scene.ActiveMB = this;
     Scene.GameStats = this._gameStats;
     Scene.SceneTracker = this._sceneTracker;
     Scene.MutantControler = this._mutantControler;
     Scene.MutantSpawnManager = this._mutantSpawnManager;
     Scene.Yacht = this._yacht;
     Scene.PlaneCrash = this._plane;
     Scene.PlaneCrashAnimGO = this._planeCrashAnimGO;
     Scene.TriggerCutScene = this._triggerCutScene;
     Scene.RainFollowGO = this._rainFollowGO;
     Scene.RainTypes = this._rainTypes;
     Scene.WeatherSystem = this._weatherSystem;
     Scene.HudGui = this._hudGui;
     Scene.Cams = this._cams;
     Scene.Clock = this._clock;
     Scene.Atmosphere = this._atmos;
     Scene.WorkScheduler = this._workScheduler;
     Scene.LoadSave = this._loadSave;
     Scene.PlaneGreebles = this._planeGreebles;
     Scene.OceanFlat = this._oceanFlat;
     Scene.OceanCeto = this._oceanCeto;
     Scene.ShoreMask = this._shoreMask;
     Scene.SinkHoleCenter = this._sinkHoleCenter;
     Scene.CaveGrounds = this._caveGrounds;
 }
Пример #31
0
 private void Awake()
 {
     Grid = GetComponent <grid>(); //getting the gride script
     MS   = MeshG.gameObject.GetComponent <MeshGenerator>();
     CC   = CCobject.gameObject.GetComponent <CamController>();
 }
 private void Awake()
 {
     playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
     camController    = GameObject.FindGameObjectWithTag("CamPivot").GetComponent <CamController>();
 }
Пример #33
0
 private void OnDestroy()
 {
     Scene.ActiveMB = null;
     Scene.GameStats = null;
     Scene.SceneTracker = null;
     Scene.MutantControler = null;
     Scene.MutantSpawnManager = null;
     Scene.Yacht = null;
     Scene.PlaneCrash = null;
     Scene.PlaneCrashAnimGO = null;
     Scene.TriggerCutScene = null;
     Scene.RainFollowGO = null;
     Scene.RainTypes = null;
     Scene.WeatherSystem = null;
     Scene.HudGui = null;
     Scene.Cams = null;
     Scene.Clock = null;
     Scene.Atmosphere = null;
     Scene.WorkScheduler = null;
     Scene.LoadSave = null;
     Scene.PlaneGreebles = null;
     Scene.OceanFlat = null;
     Scene.OceanCeto = null;
     Scene.ShoreMask = null;
     Scene.SinkHoleCenter = null;
     Scene.CaveGrounds = null;
 }