Наследование: MonoBehaviour
Пример #1
0
    void Awake()
    {
        if(manager != null)    //if manager does exist, destroy this copy
            Destroy(gameObject);

        manager = this;
    }
Пример #2
0
 public WaitingState(StateMachine sm, CameraManager cam, Game game, float time, Team team, bool _onWiningPoints)
     : base(sm, cam, game)
 {
     this.remainingTime 	= time;
     this.TeamOnSuper 	= team;
     this.onWiningPoints = true;
 }
Пример #3
0
 protected void gvwCamera_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     string id = gvwCamera.DataKeys[e.RowIndex].Value.ToString();
     CameraManager cm = new CameraManager();
     cm.DeleteCamera(id, Session["userid"].ToString());
     Query();
 }
Пример #4
0
 private void Start()
 {
     if (!string.IsNullOrEmpty(this.PoseStd) && base.gameObject.animation)
     {
         base.gameObject.animation.CrossFade(this.PoseStd);
     }
     this.cameraMgr = Tools.GetSafeComponent<CameraManager>(base.gameObject);
     this.navAgent = Tools.GetSafeComponent<NavMeshAgent>(base.gameObject);
     this.navAgent.radius = 0.2f;
     this.navAgent.speed = 2.8f;
     this.navAgent.acceleration = 40960f;
     this.navAgent.autoRepath = false;
     this.navAgent.obstacleAvoidanceType = ObstacleAvoidanceType.NoObstacleAvoidance;
     this.navAgent.updateRotation = false;
     GameObject gameObject = Res.Load<GameObject>("Skill/st_002", false);
     if (gameObject != null)
     {
         this.attackArea = (UnityEngine.Object.Instantiate(gameObject) as GameObject);
         if (this.attackArea != null)
         {
             this.attackArea.transform.parent = base.transform;
             this.attackArea.transform.localPosition = Vector3.zero;
             this.attackArea.transform.localRotation = Quaternion.identity;
             this.attackArea.transform.localScale = Vector3.one;
             this.attackArea.layer = base.gameObject.layer;
         }
     }
 }
Пример #5
0
 //------------------------------------------------AWAKE--------------------------------------
 void Awake()
 {
     if(m_instance == null)
         m_instance = this;
     else
         Destroy(gameObject);
 }
Пример #6
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void Awake()
    {
        cameraManager = GameObject.Find("_CameraTarget").GetComponent<CameraManager>();

        m_groc.gameObject.SetActive(false);
        m_verd.gameObject.SetActive(false);
    }
Пример #7
0
 public WaitingState(StateMachine sm, CameraManager cam, Game game, float time, Team TeamOnSuper)
     : base(sm, cam, game)
 {
     this.remainingTime = time;
     this.TeamOnSuper = TeamOnSuper;
     this.onWiningPoints = false;
 }
Пример #8
0
 // Use this for references
 void Awake() {
     cameraManager = GameObject.FindGameObjectWithTag("CameraManager").GetComponent<CameraManager>();
     rigBody = GetComponent<Rigidbody>();
     Collider[] colliders = GetComponents<Collider>();
     standingColl = colliders[0];
     crouchingColl = colliders[1];
 }
Пример #9
0
	protected virtual void Awake()
	{
		playerManager = GameObject.FindWithTag("Player").GetComponent<PlayerManager>();
		cam = GameObject.Find("Camera");
		cameraManager = GameObject.Find("Camera").GetComponent<CameraManager>();
		playerCanvasManager = GameObject.Find("PlayerCanvas").GetComponent<PlayerCanvasManager>();
		StartCoroutine(StartMovie());
	}
Пример #10
0
 public override void StartStep()
 {
     FindObjectOfType<GameUIManager>().gameObject.SetActive(false);
     mainCamera = Camera.main;
     cameraManager = mainCamera.gameObject.GetComponent<CameraManager>();
     cameraManager.enabled = false;
     mainCamera.DOShakePosition(duration, strenght, vibrato).OnComplete(OnShakeComplete);
 }
Пример #11
0
 public override void StartStep()
 {
     mainCamera = Camera.main;
     cameraManager = mainCamera.gameObject.GetComponent<CameraManager>();
     cameraManager.enabled = false;
     mainCamera.gameObject.transform.DOMoveY(toMove, duration).SetEase(ease);
     EndStep();
 }
	private void Awake()
	{
		camManager = Camera.mainCamera.GetComponent<CameraManager>();
		cController = GetComponent<CharacterController>();
		animator = GetComponent<Animator>();

		camManager.player = this;
	}
Пример #13
0
	public override void StartScene (System.Action endCallback, CameraManager cameraManager)
	{
		base.StartScene (endCallback, cameraManager);
		Character character = Menu.Instance.GetCharacterByType(CharacterType.Ataraxia);
		character.PositionTo (initPositionCharacter.position);
		Invoke (Helpers.NameOf(StartDialog),timeToStartMessage);

	}
Пример #14
0
 private void OnCameraChange(CameraManager.CameraMode cameraMode)
 {
     if (cameraMode == CameraManager.CameraMode.IVA) {
         isActive = true;
         activatedAt = DateTime.Now;
     } else
         isActive = false;
 }
Пример #15
0
 public ConnectionManager(WebcamServer s)
 {
     server = s;
     camManager = new CameraManager();
     clients = new List<string>();
     udpSender = new UdpClient();
     udpListener = new UdpClient(1112);
     udpListener.BeginReceive(new AsyncCallback(OnReceive), udpListener);
 }
Пример #16
0
    void Awake()
    {
        playerCamera = GameObject.Find("Player Camera").GetComponent<Camera>();
        minimapCamera = GameObject.Find("Minimap Camera").GetComponent<Camera>();
        currPlayer = playerCamera.transform.parent.gameObject.GetComponent<Player>();
        world = GameObject.Find("World");

        cameraMgr = GameObject.FindObjectOfType<CameraManager>();
    }
Пример #17
0
    // Use this for initialization
    void Awake()
    {
        cm = GetComponentInParent<CameraManager>();

        if (activator1 != null)
        {
            //store activator gameObject in a temporary variable for when null we can retrieve later
            GameObject temp = activator1;
            //  Checks for a trigger collider; If the game object in the activator slot
            // is not trigger, but has a child that is a trigger, the child becomes the activator
            if (activator1.transform.childCount > 0)
            {
                Collider[] _activator1 = activator1.gameObject.GetComponentsInChildren<Collider>();
                activator1 = null;

                foreach (Collider c in _activator1)
                {
                    if (c.isTrigger == true)
                        activator1 = c.gameObject;
                }

                if (activator1 == null)
                    activator1 = temp;

            }
        }
        //do the same thing if a second activator exists
        if (activator2 != null)
        {
            GameObject temp = activator2;
            if (activator2.transform.childCount > 0)
            {
                Collider[] _activator2 = activator2.gameObject.GetComponentsInChildren<Collider>();
                activator2 = null;

                foreach (Collider c in _activator2)
                {
                    if (c.isTrigger == true)
                        activator2 = c.gameObject;
                }

                if (activator2 == null)
                    activator2 = temp;

            }
        }

        //listening for "checkpoint" to swap cameras
        Messenger.AddListener<GameObject,Transform>(listeningForSetCam, SetCam);
        //listening for "playerdied" to switch the follow targets to the alive player
        Messenger.AddListener<string>(listeningForReTarget, SetTarget);
        Messenger.MarkAsPermanent(listeningForSetCam);
        Messenger.MarkAsPermanent(listeningForReTarget);
        if (!startCam)
            gameObject.SetActive(false);
    }
Пример #18
0
    void Awake() {

        instance = this;
        isChangingCameras = false;

        //if(transitionCamera) {
        //    scTransitionCamera = transitionCamera.GetComponent<TransitionCamera>();
        //}

    }
Пример #19
0
 public static CameraManager GetCameraManager()
 {
     if(cameraManager == null)
     {
         cameraManager = cameraManagerGameObject.AddComponent<CameraManager>();
     }
     else
         return null;
     return cameraManager;
 }
Пример #20
0
	public virtual void StartScene (Action endCallback, CameraManager cameraManager)
	{
		isOver = false;
		End = endCallback;
		this.cameraManager = cameraManager;
		if(camera != null)
			this.cameraManager.SetCamera3D(camera);
		else
			this.cameraManager.SetDefault ();
	}
Пример #21
0
    void Start()
    {
		turnsCompleted = 0;
        gameManager = this;
        currentPlayers = new LinkedList<Entity>();
        currentTurn = JANITOR;
        cameraManager = GetComponent<CameraManager>();
        uiManager = GameObject.FindObjectOfType<UIManager>();
        turnsLeft = turnsPerPlayer;
    }
Пример #22
0
    public void Awake()
    {
        if (_instance != null)
        {
            Debug.Log("Error. There was AN ERROR");
            return;
        }

        _instance = this;
    }
Пример #23
0
    // Use this for initialization
    void Awake()
    {
        cm = GetComponentInParent<CameraManager>();

        Messenger.AddListener<string,string>(listeningForSetCam, SetCam);
        Messenger.AddListener<string>(listeningForReTarget, SetTarget);
        Messenger.MarkAsPermanent(listeningForSetCam);
        Messenger.MarkAsPermanent(listeningForReTarget);
        if (!startCam)
            gameObject.SetActive(false);
    }
Пример #24
0
    void Awake()
    {
        if (cameraManager == null)
            cameraManager = GetComponent<CameraManager>();

        backKiller = transform.Find ("BackKiller");
        fallingKiller = transform.Find ("FallingKiller");

        backKillerCollider = backKiller.GetComponent<Collider2D>();
        fallingKillerCollider = fallingKiller.GetComponent<Collider2D>();
    }
Пример #25
0
	public override void StartScene (System.Action endCallback, CameraManager cameraManager)
	{
		Character characterOldMan = Menu.Instance.GetCharacterByType (CharacterType.GranSabio);
		Character ataraxia = Menu.Instance.GetCharacterByType (CharacterType.Ataraxia);
		startPoint = characterOldMan.transform;
		endPoint = ataraxia.transform;
		base.StartScene (endCallback, cameraManager);
		GameObject prefabDiceGO = Instantiate (prefabDice,startPoint.position + Vector3.up,Quaternion.identity) as GameObject;
		dice = prefabDiceGO.transform;
		StartDialog ();
	}
Пример #26
0
        /// <summary>
        /// Create a state with a 3D scene and a camera.
        /// </summary>
        /// <param name="camera">Camera to use on this scene.</param>
        public YnState3D(BaseCamera camera)
            : base()
        {
            if (camera != null)
                _cameraManager = new CameraManager(camera);
            else
                _cameraManager = new CameraManager();

            _scene = new YnScene3D();
            _basicObjects = new YnBasicCollection();
        }
Пример #27
0
 protected void btnModify_Click(object sender, EventArgs e)
 {
     Cameras c = new Cameras();
     c.Assertno = txtAssertNo.Text;
     c.Caremano = txtCameraNo.Text;
     c.Customeraddress = txtCustomerAddress.Text;
     c.Customername = txtCustomerName.Text;
     c.Handleno = txtHandleNo.Text;
     c.Info = txtInfo.Text;
     c.Installdate = txtInstalldate.Text.Trim() == "" ? DateTime.Now : Convert.ToDateTime(txtInstalldate.Text.Trim());
     c.Installplace = txtInstallPlace.Text;
     c.Junctionboxno = txtJunctionBoxNo.Text;
     c.Latitude = txtLatitude.Text.Trim() == "" ? 0 : Convert.ToDouble(txtLatitude.Text.Trim());
     c.Linkman = txtLinkman.Text;
     c.Linkman_phone = txtLinkmanPhone.Text;
     c.Longitude = txtLongitude.Text.Trim() == "" ? 0 : Convert.ToDouble(txtLongitude.Text.Trim());
     c.Singleplace = txtSinglePlace.Text;
     c.Storagetime = txtStorageTime.Text;
     c.Baudrate = ddlBaudrate.SelectedValue;
     c.Caremakind = ddlCameraKind.SelectedValue;
     c.Carematype = ddlCameraType.SelectedValue;
     c.Codeaddr = ddlCodeAddr.SelectedValue;
     c.Codestream = ddlCodeStream.SelectedValue;
     c.Controlprotocol = ddlControlProtocol.SelectedValue;
     c.Customertype = ddlCustomerType.SelectedValue;
     c.Devicelevel = ddlDeviceLevel.SelectedValue;
     c.Devicemanu = ddlDeviceManu.SelectedValue;
     c.Devicepropertyright = ddlDevicePropertyRight.SelectedValue;
     c.Devicestate = ddlDeviceState.SelectedValue;
     c.Dvsport = ddlDvsPort.SelectedValue;
     c.Installmode = ddlInstallMode.SelectedValue;
     c.Paymenttype = ddlPaymentType.SelectedValue;
     c.Powertype = ddlPowerType.SelectedValue;
     c.Powervoltage = ddlPowerVoltage.SelectedValue;
     c.Storagetype = ddlStorageType.SelectedValue;
     c.Switchinmode = ddlSwitchinMode.SelectedValue;
     c.Switchinplace = ddlSwitchinPlace.SelectedValue;
     c.Dvsid = hdfDvsID.Value;
     c.Suburb = hdfSuburbID.Value;
     if (hdfCameraID.Value == "0" || hdfCameraID.Value == "")  //新增
     {
         CameraManager cm = new CameraManager();
         cm.NewCamera(c, Session["userid"].ToString());
         hdfCameraID.Value = c.Id.ToString();
         btnModify.Text = "确定修改";
     }
     else
     {
         c.Id = DataGlobal.ConvertToInt(hdfCameraID.Value);
         CameraManager cm = new CameraManager();
         cm.ModifyCamera(c, Session["userid"].ToString());
     }
 }
Пример #28
0
 public static GameObject GetCameraManagerGameActor()
 {
     if(cameraManagerGameObject == null)
     {
         cameraManagerGameObject = GameObject.Find("CameraManager");
     }
     else if(cameraManager == null)
     {
         cameraManager = cameraManagerGameObject.AddComponent<CameraManager>();
     }
     return gameManagerGameObject;
 }
Пример #29
0
 // Use this for initialization
 void Start()
 {
     leafmaterial = GameObject.Find("MainLine001");
     leafmaterial.renderer.material = material1;
     leaf = GameObject.Find("leaf1");
     //leaf.animation["idle"].wrapMode = WrapMode.Loop;
     controller = GetComponent<CharacterController>();
     inputcontroller = GetComponent<PlatformInputController>();
     soundmanager = GameObject.Find("SoundManager").GetComponent<SoundManager>();
     cameramanager = GameObject.Find("MainCamera").GetComponent<CameraManager>();
     CameraIntro = GameObject.Find("CameraIntro");
 }
Пример #30
0
 // Use this for initialization
 void Start()
 {
     if(CameraManager.instance != null) {
         Debug.LogError("Multipel CameraManager instances!");
         Destroy(gameObject);
         return;
     }
     CameraManager.instance = this;
     cameras = System.Array.ConvertAll(GetComponentsInChildren<Camera>(),
         t => t.gameObject);
     Current = Camera.main.gameObject;
 }
Пример #31
0
        public DeferredColoredChunkRenderer(EngineConfiguration config, ContentLibrary contentLibrary, GraphicsDevice device, CameraManager cameraManager, IChunkManager chunkManager)
        {
            _device = device;
            _sb     = new SpriteBatch(_device);

            _halfPixel = new Vector2(0.5f / _device.PresentationParameters.BackBufferWidth, 0.5f / _device.PresentationParameters.BackBufferHeight);

            _quadRenderer = new QuadRenderer(_device);

            _clearEffect            = new ClearEffect(contentLibrary.ClearEffect);
            _renderGBufferEffect    = new RenderGBufferColorEffect(contentLibrary.RenderGBufferColorEffect);
            _renderCombineEffect    = new RenderCombineEffect(contentLibrary.RenderCombineEffect);
            _directionalLightEffect = new DirectionalLightEffect(contentLibrary.DirectionalLightEffect);
            _pointLightEffect       = new PointLightEffect(contentLibrary.PointLightEffect);
            _ssaoEffect             = new SSAOEffect(contentLibrary.SSAOEffect);

            _camManager = cameraManager;
            _chunks     = chunkManager;

            _debugOptions = ChunkRendererDebugOptions.NONE;

            basicEffect = contentLibrary.BasicEffect;

            _uiFontTiny = contentLibrary.UIFontTiny;

            _albedoTarget = new RenderTarget2D(_device, _device.PresentationParameters.BackBufferWidth, _device.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
            _lightTarget  = new RenderTarget2D(_device, _device.PresentationParameters.BackBufferWidth, _device.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None);
            _normalTarget = new RenderTarget2D(_device, _device.PresentationParameters.BackBufferWidth, _device.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None);
            _depthTarget  = new RenderTarget2D(_device, _device.PresentationParameters.BackBufferWidth, _device.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Single, DepthFormat.Depth24Stencil8);

            _randomMap = new Texture2D(_device, _device.PresentationParameters.BackBufferWidth, _device.PresentationParameters.BackBufferHeight);
            CreateRandomNormalTexture(_randomMap);

            _debugRasterizerState = new RasterizerState()
            {
                CullMode = Microsoft.Xna.Framework.Graphics.CullMode.None, FillMode = Microsoft.Xna.Framework.Graphics.FillMode.WireFrame
            };
            _rasterizerState = new RasterizerState()
            {
                CullMode = Microsoft.Xna.Framework.Graphics.CullMode.CullCounterClockwiseFace
            };
        }
Пример #32
0
    // Update is called once per frame
    void Update()
    {
        if (enableTyping)
        {
            if (Input.anyKeyDown)
            {
                if (wrongMessage.Equals(text.text))
                {
                    text.text = "";
                }

                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    enableTyping = false;
                    CameraManager.GetInstance().mainCamera.gameObject.SetActive(true);
                    CameraManager.GetInstance().computerCamera.gameObject.SetActive(false);
                    text.fontSize = 1.0f;
                    textObject.transform.localScale = new Vector3(1, 1, 1);

                    textObject.transform.position   = defaultPos;
                    textObject.transform.rotation   = defaultRotation;
                    textObject.transform.localScale = defaultScale;
                    return;
                }
                else if (!canType)
                {
                    return;
                }
                else if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
                {
                    if (password.Equals(text.text))
                    {
                        AudioManager.GetInstance().PlayAudio(gameObject.name);
                        m_dialogtree = Resources.Load <DialogTree>("Dialog/Computer/ComputerAfterPowerTree");

                        text.text = "Welcome back Daniel";

                        m_dialogtree.MoveToRoot();
                        m_dialogtree.MoveDown(4);
                        m_dialogtree.Current.DelegatePointer.Function.AddListener(() =>
                        {
                            GameObject droomba = GameObject.Find("Droomba");
                            if (!droomba.GetComponent <DroombaAI>().isCleaning)
                            {
                                droomba.GetComponent <DroombaAI>().enabled = true;
                            }
                        });
                        canType = false;
                    }
                    else
                    {
                        AudioManager.GetInstance().PlayAudio(text.gameObject.name);
                        text.text = wrongMessage;
                    }
                }

                foreach (char characters in Input.inputString)
                {
                    if (char.IsDigit(characters))
                    {
                        text.text += characters;
                    }
                    else if (char.IsLetter(characters))
                    {
                        text.text += characters;
                    }
                    else if (characters == (char)8 && text.text.Length > 0)
                    {
                        text.text = text.text.Remove(text.text.Length - 1);
                    }
                    else if ((characters == (char)8 && text.text.Length <= 0) || characters == (char)27)
                    {
                        enableTyping = false;
                        CameraManager.GetInstance().mainCamera.gameObject.SetActive(true);
                        CameraManager.GetInstance().computerCamera.gameObject.SetActive(false);

                        textObject.transform.position   = defaultPos;
                        textObject.transform.rotation   = defaultRotation;
                        textObject.transform.localScale = defaultScale;
                    }
                }
            }
        }
    }
Пример #33
0
 private Lamp(CameraManager cameraManager, string defaultCameraId)
 {
     _cameraManager   = cameraManager;
     _defaultCameraId = defaultCameraId;
 }
Пример #34
0
 void Start()
 {
     theCamera = FindObjectOfType <CameraManager>();
 }
Пример #35
0
        public Rectangle getAreaOnScreen(Point original, ISpriteInterface sprite, CameraManager camera)
        {
            Vector2 screenPos = getScreenPos(original, camera);

            return(new Rectangle((int)Math.Ceiling(screenPos.X - sprite.Texture.Width / sprite.Columns / camera.ZoomFactor), (int)Math.Ceiling(screenPos.Y - sprite.Texture.Height / sprite.Rows / camera.ZoomFactor), (int)Math.Ceiling(sprite.Texture.Width / sprite.Columns / camera.ZoomFactor), (int)Math.Ceiling(sprite.Texture.Height / sprite.Rows / camera.ZoomFactor)));
        }
Пример #36
0
 public void Gameover()
 {//カメラのチェンジ
     SubCamera.SetActive(true);
     _cameMane = SubCamera.GetComponent <CameraManager>();
     _cameMane.CameraZoomOut();
 }
Пример #37
0
 private void Awake()
 {
     instance = this;
     instance.Init();
 }
Пример #38
0
 void Start()
 {
     cinematicCamera = GameObject.Find("CameraManager").GetComponent <CameraManager>();
     _Blockade1      = GameObject.Find("Blockade1");
     AI_Beckoning.SetActive(false);
 }
Пример #39
0
 public BallFlyingState(StateMachine sm, CameraManager cam, Game game) : base(sm, cam, game)
 {
 }
Пример #40
0
 void Update()
 {
     //movement.RotateHand(CameraManager.GetCameraRotation());
     movement.RotateBody(CameraManager.GetCameraRotationY());
 }
Пример #41
0
 // Use this for initialization
 void Awake()
 {
     cameraManager = GameObject.FindWithTag("CameraManager").GetComponent <CameraManager> ();
     gameManager   = GameObject.FindWithTag("GameManager").GetComponent <GameManager> ();
 }
Пример #42
0
 // Start is called before the first frame update
 void Start()
 {
     bound     = GetComponent <BoxCollider2D>();
     theCamera = FindObjectOfType <CameraManager>();
     theCamera.SetBound(bound);
 }
Пример #43
0
    public static CameraManager singleton; //You can call CameraManager.singleton from other script (There can be only one)

    private void awake()
    {
        singleton = this; //Self-assigns
        Init();
    }
Пример #44
0
 // Start is called before the first frame update
 void Start()
 {
     Instance = this;
     MoveToNextSpot();
 }
Пример #45
0
 private void Start()
 {
     instance = this;
     pos      = transform.position;
     rot      = transform.localEulerAngles;
 }
Пример #46
0
 public DualContourColoredChunkSystem(GraphicsDevice device, ContentLibrary contentLibrary, IChunkManager chunkManager, CameraManager cameraManager, World world, ITerrainGradientFunction densityGradientFunction, float minimumSolidDensity)
 {
     _builder  = new DualContourChunkBuilder(device, world, densityGradientFunction, minimumSolidDensity);
     _renderer = new ColoredChunkRenderer(world.EngineConfiguration, contentLibrary, device, cameraManager, chunkManager);
 }
Пример #47
0
        void LateUpdate()
        {
            if (!config.engageMuffler)
            {
                return;
            }

            AudioSource[] audioSources = FindObjectsOfType(typeof(AudioSource)) as AudioSource[];

            cacheManager.maintainCaches(audioSources);

            //Looking for a part containing the Ear:
            Part earPart = null;

            //if (vesselGeometry.isPointInVesselBounds(earPosition))
            {
                if (CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA)
                {
                    earPart = CameraManager.Instance.IVACameraActiveKerbal.InPart;
                    writeDebug("Ear position = IVA");
                }
                else
                {
                    Vector3 earPosition = CameraManager.GetCurrentCamera().transform.position;
                    writeDebug("Ear position = " + earPosition);
                    for (int i = 0; i < FlightGlobals.ActiveVessel.Parts.Count && earPart == null; i++)
                    {
                        Part part = FlightGlobals.ActiveVessel.Parts[i];
                        if (cacheManager.vesselGeometry.isPointInPart(earPosition, part))
                        {
                            earPart = part;
                        }
                    }
                }
            }

            writeDebug("Ear part = " + (earPart != null ? earPart.name : "null"));

            //Setting up helmet channel:

            bool unmanned = FlightGlobals.ActiveVessel.crewableParts == 0;

            bool muteHelmet = (earPart == null) && !config.helmetOutsideEVA && FlightGlobals.ActiveVessel.isEVA ||
                              !FlightGlobals.ActiveVessel.isEVA && !unmanned && !config.helmetOutsideIVA && !(CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA) ||
                              !config.helmetForUnmanned && unmanned;

            //Setting up outside channel:
            float atmosphericCutoff = Mathf.Lerp(config.minimalCutoff, 30000, (float)FlightGlobals.ActiveVessel.atmDensity);

            if (earPart != null)
            {
                audioMixer.setOutsideCutoff(Mathf.Min(config.wallCutoff, atmosphericCutoff));
                audioMixer.setInVesselVolume(-2f);
                audioMixer.setOutsideVolume(-12f);
            }
            else
            {
                audioMixer.setOutsideCutoff(atmosphericCutoff);
                audioMixer.setInVesselVolume(0f);
                audioMixer.setOutsideVolume(0f);
            }

            //Handling Map view settings:
            bool isMapView = CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.Map;

            muteHelmet = muteHelmet || !config.helmetInMapView && isMapView;

            audioMixer.muteHelmet(muteHelmet);
            audioMixer.muteInVessel(!config.vesselInMapView && isMapView);
            audioMixer.muteOutside(!config.outsideInMapView && isMapView);

            //Routing all current audio sources:
            for (int i = 0; i < audioSources.Length; i++)
            {
                AudioSource audioSource = audioSources[i];

                /*
                 *      Hereafter audio sources that are bound to a part's InternalModel are handled differently from the rest because InternalModel has its own reference system,
                 *      so these two systems shouldn't be mixed until the way to convert coordinates between them is found
                 */

                if (config.debug)
                {
                    writeDebug("Sound " + i + " clp=" + (audioSource.clip == null ? "null" : audioSource.clip.name) + ": plyng=" + audioSource.isPlaying +
                               " trf.nm=" + audioSource.transform.name + " trf.pos=" + audioSource.transform.position +
                               " amb=" + StockAudio.isAmbient(audioSource) + " inves=" + StockAudio.isInVessel(audioSource));
                }

                //This "if" is here because of strange behaviour of StageManager's audio source which always has clip = null and !playing when checked
                if (StockAudio.isInVessel(audioSource))
                {
                    writeDebug("Sound " + i + ":" + audioSource.name + " IN VESSEL");
                    audioSource.outputAudioMixerGroup = earPart != null ? audioMixer.inVesselGroup : audioMixer.outsideGroup;
                    continue;
                }

                if (/*audioSource.bypassEffects ||*/ StockAudio.isPreserved(audioSource) || (audioSource.clip == null) || (!audioSource.isPlaying))
                {
                    continue;
                }

                if (StockAudio.isAmbient(audioSource))
                {
                    writeDebug("Sound " + i + ":" + audioSource.name + " OUTSIDE");
                    audioSource.outputAudioMixerGroup = audioMixer.outsideGroup;
                    continue;
                }

                if (isSoundInHelmet(audioSource))
                {
                    writeDebug("Sound " + i + ":" + audioSource.name + " IN HELMET");
                    audioSource.outputAudioMixerGroup = audioMixer.helmetGroup;
                    continue;
                }

                bool isRouted = false;
                if (earPart != null /*&& vesselGeometry.isPointInVesselBounds(audioSource.transform.position)*/)
                {
                    Part boundToPartIVA = cacheManager.vesselSounds.getPartForIVA(audioSource);
                    if (boundToPartIVA != null)
                    {
                        if (earPart.Equals(boundToPartIVA))
                        {
                            writeDebug("Sound " + i + ":" + audioSource.name + " SAME AS EAR, INTERNAL");
                            audioSource.outputAudioMixerGroup = null;                             //if audioSource is in the same part with the Ear then skipping filtering
                            continue;
                        }
                        else
                        {
                            writeDebug("Sound " + i + ":" + audioSource.name + " ANOTHER PART, INTERNAL");
                            audioSource.outputAudioMixerGroup = audioMixer.inVesselGroup;                             //if audioSource is in another part of the vessel then applying constant muffling
                            continue;
                        }
                    }

                    //Below the following assumption is used: if an audioSource is bound to a part (by having the same transform) then it most likely is located inside that part,
                    //so in the most cases it will be enough to test just the part's meshes instead of sequentially testing all of the vessel's meshes, thus greatly improve
                    //performance in case of a high part count:

                    //if (CameraManager.Instance.currentCameraMode != CameraManager.CameraMode.IVA) { //TODO remove this check when a proper way to transform coordinates between InternalModel and part's transform is found
                    if (audioSource.transform.IsChildOf(earPart.transform) && cacheManager.vesselGeometry.isPointInPart(audioSource.transform.position, earPart))
                    {
                        writeDebug("Sound " + i + ":" + audioSource.name + " SAME AS EAR");
                        audioSource.outputAudioMixerGroup = null;                                 //if audioSource is in the same part with the Ear then skipping filtering
                        continue;
                    }
                    //}

                    Part boundPart = cacheManager.vesselSounds.getPartFor(audioSource);
                    if (boundPart != null && !boundPart.Equals(earPart) && cacheManager.vesselGeometry.isPointInPart(audioSource.transform.position, boundPart))
                    {
                        writeDebug("Sound " + i + ":" + audioSource.name + " ANOTHER PART");
                        audioSource.outputAudioMixerGroup = audioMixer.inVesselGroup;                         //if audioSource is in another part of the vessel then applying constant muffling
                        continue;
                    }

                    //To this point the audioSource should be already routed as in the game the vast majority of sounds are either helmet sounds, or bound to parts, or are ambient.
                    //So only a few sounds are expected to pass to the following mesh-by-mesh test:

                    for (int p = 0; p < FlightGlobals.ActiveVessel.Parts.Count && !isRouted; p++)
                    {
                        Part part = FlightGlobals.ActiveVessel.Parts[p];
                        if (part.Equals(boundPart))                           //if the audioSource is bound to some part, then this part is already checked earlier
                        {
                            continue;
                        }

                        if (cacheManager.vesselGeometry.isPointInPart(audioSource.transform.position, part))
                        {
                            if (part.Equals(earPart))
                            {
                                writeDebug("Sound " + i + ":" + audioSource.name + " SAME AS EAR");
                                audioSource.outputAudioMixerGroup = null;                                 //if audioSource is in the same part with the Ear then skipping filtering
                            }
                            else
                            {
                                writeDebug("Sound " + i + ":" + audioSource.name + " ANOTHER PART");
                                audioSource.outputAudioMixerGroup = audioMixer.inVesselGroup;                                 //if audioSource is in another part of the vessel then applying constant muffling
                            }
                            isRouted = true;
                        }
                    }
                }

                if (isRouted)
                {
                    continue;
                }

                writeDebug("Sound " + i + ":" + audioSource.name + " OUTSIDE");
                audioSource.outputAudioMixerGroup = audioMixer.outsideGroup;
            }
        }
Пример #48
0
 // Use this for initialization
 void Awake()
 {
     instance = this;
 }
Пример #49
0
    public void SetTarget(Hex v, Hex start, int y)
    {
        act = ACT.IDLE;
        if (type == "fire")
        {
            act = ACT.IDLE;
            if (curmagic_id == 1)
            {
                fireball[] fireb = new fireball[8];
                for (int i = 0; i < 8; ++i)
                {
                    fireb[i]           = ((GameObject)Instantiate(magics[0])).GetComponent <fireball>();
                    fireb[i].targetHex = v;
                    Vector3 v2 = v.transform.position;
                    v2 = new Vector3(v2.x, 2, v2.z);
                    Vector3 Start = start.transform.position;
                    if (i == 2)
                    {
                        Start.z -= 6;
                    }
                    if (i == 3)
                    {
                        Start.z += 6;
                    }
                    if (i == 4)
                    {
                        Start.z += 3;
                    }
                    if (i == 5)
                    {
                        Start.z -= 3;
                    }
                    if (i == 6)
                    {
                        Start.x += 3;
                    }
                    if (i == 7)
                    {
                        Start.x += 3;
                    }
                    if (i == 1)
                    {
                        Start.x -= 6;
                    }
                    if (i == 0)
                    {
                        Start.x += 6;
                    }
                    Start.y                     = 10;
                    fireb[i].target             = v2;
                    fireb[i].transform.position = Start;

                    fireb[i].fire = true;
                }
            }
            else
            {
                fireball fireb = new fireball();
                fireb           = ((GameObject)Instantiate(magics[0])).GetComponent <fireball>();
                fireb.targetHex = v;
                Vector3 v2 = v.transform.position;
                v2 = new Vector3(v2.x, 2, v2.z);
                Vector3 Start = start.transform.position;
                Start.y                  = 9;
                fireb.target             = v2;
                fireb.transform.position = Start;

                fireb.fire = true;
            }
        }
        else if (type == "wall")
        {
            //  wall wal = ((GameObject)Instantiate(magics[2])).GetComponent<wall>();
        }
        else if (type == "wind")
        {
            EffectManager.GetInst().ShowEffect_Summon(v.gameObject, 10, 2);
            MapManager.GetInst().ResetMapColor();
            MapManager.GetInst().MarkAttackRange(v, 3, false);
            v.At_Marked = true;


            CameraManager.GetInst().ResetCameraTarget();
            CostManager.GetInst().CostDecrease(CostManager.GetInst().Curcostnum);
        }
        else if (type == "water")
        {
            if (curmagic_id == 2)
            {
                fireball[] fireb = new fireball[4];
                for (int i = 0; i < 4; ++i)
                {
                    fireb[i]           = ((GameObject)Instantiate(magics[1])).GetComponent <fireball>();
                    fireb[i].targetHex = v;
                    Vector3 v2 = v.transform.position;
                    v2 = new Vector3(v2.x, 0, v2.z);
                    Vector3 Start = start.transform.position;
                    if (i == 2)
                    {
                        Start.z -= 8;
                    }
                    if (i == 3)
                    {
                        Start.z += 8;
                    }
                    if (i == 1)
                    {
                        Start.x -= 8;
                    }
                    if (i == 0)
                    {
                        Start.x += 8;
                    }
                    Start.y = y;

                    fireb[i].target             = v2;
                    fireb[i].transform.position = Start;
                    fireb[i].fire = true;
                }
            }
            else
            {
                fireball fireb = new fireball();

                fireb           = ((GameObject)Instantiate(magics[3])).GetComponent <fireball>();
                fireb.targetHex = v;
                Vector3 v2 = v.transform.position;
                v2 = new Vector3(v2.x, 0, v2.z);
                Vector3 Start = start.transform.position;
                Start.y                  = 10f;
                fireb.target             = v2;
                fireb.transform.position = Start;
                fireb.fire               = true;
            }
        }
    }
Пример #50
0
 public Renderer()
 {
     entityList = new List <iEntity>();
     uiList     = new List <iEntity>();
     cameraMan  = new CameraManager();
 }
 private void Awake()
 {
     CameraYaxisMultiplier = 2;
     cameraManager         = GameObject.FindGameObjectWithTag("GameSetting").GetComponent <CameraManager>();
     playerMovement        = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovementV2>();
 }
Пример #52
0
 public void Init()
 {
     instance        = this;
     cameraTransform = transform;
 }
Пример #53
0
 public GameActionState(StateMachine sm, CameraManager cam, Game game) : base(sm, cam, game)
 {
 }
Пример #54
0
    ////////////////////////////////////////////////

    public static void AssignCameraToActiveUnit()
    {
        CameraManager.SetCamToOrbitUnit(_activeUnit);
        LayerManager.ChangeCameraLayer(_activeUnit.CubeUnitIsOn);
    }
Пример #55
0
 void Awake()
 {
     instance  = this;
     baseAngle = new Vector3(90, 0, 0);
 }
Пример #56
0
    public float lastSize;                //Конечный размер камеры

    private void Awake()
    {
        instance = this;
    }
Пример #57
0
    private void RaycastItem()
    {
        player = FindObjectOfType <Player>();
        RaycastHit hit = CameraManager.GetCameraRaycast(player.GetStats().InteractRange);

        if (hit.transform)
        {
            if (Input.GetButtonDown("Collect"))
            {
                IInventoryItem item = hit.transform.GetComponent <IInventoryItem>();

                IInventoryItem rpg = null;
                for (int i = 0; i < inventory.wSlots.Count; i++)
                {
                    if (inventory.wSlots[i].mItemStack.Count != 0)
                    {
                        rpg = inventory.GetPeekItem(i, "Weapon");
                    }
                    if (rpg != null)
                    {
                        rpg = inventory.GetPeekItem(i, "Weapon");
                        if (rpg.Name == "Bazuka")
                        {
                            break;
                        }
                        else
                        {
                            rpg = null;
                        }
                    }
                }

                if (hit.transform.CompareTag("Ammo"))
                {
                    item.Collected = true;
                    SaveManager.instance.collected[item.Id] = true;

                    if (hit.transform.GetComponent <IInventoryItem>().Name == "Ammo 9mm")
                    {
                        WeaponManager.instance.GetComponent <Pistol>().CurrentSpare += item.Amount;
                    }
                    if (hit.transform.GetComponent <IInventoryItem>().Name == "Ammo Dart")
                    {
                        WeaponManager.instance.GetComponent <Sedat>().CurrentSpare += item.Amount;
                    }
                    if (hit.transform.GetComponent <IInventoryItem>().Name == "Ammo Shotgun")
                    {
                        WeaponManager.instance.GetComponent <Shotgun>().CurrentSpare += item.Amount;
                    }


                    if (SaveManager.instance.currentWeapon == WeaponEnum.Pistol)
                    {
                        UIManager.instance.UpdateAmmo(WeaponManager.instance.GetComponent <Pistol>().CurrentAmmo, WeaponManager.instance.GetComponent <Pistol>().CurrentSpare);
                    }
                    else if (SaveManager.instance.currentWeapon == WeaponEnum.Sedat)
                    {
                        UIManager.instance.UpdateAmmo(WeaponManager.instance.GetComponent <Sedat>().CurrentAmmo, WeaponManager.instance.GetComponent <Sedat>().CurrentSpare);
                    }
                    else if (SaveManager.instance.currentWeapon == WeaponEnum.Shotgun)
                    {
                        UIManager.instance.UpdateAmmo(WeaponManager.instance.GetComponent <Shotgun>().CurrentAmmo, WeaponManager.instance.GetComponent <Shotgun>().CurrentSpare);
                    }
                    else if (SaveManager.instance.currentWeapon == WeaponEnum.Bazuka)
                    {
                        UIManager.instance.UpdateAmmo(WeaponManager.instance.GetComponent <Bazuka>().CurrentAmmo, WeaponManager.instance.GetComponent <Bazuka>().CurrentSpare);
                    }
                    item.OnPickUp();
                }
                else if (hit.transform.CompareTag("Item"))
                {
                    item.Collected = true;
                    SaveManager.instance.collected[item.Id] = true;
                    inventory.AddItem(item, "Item");
                }
                else if (hit.transform.CompareTag("Weapon") && rpg != null)
                {
                    item.Collected = true;
                    SaveManager.instance.collected[item.Id] = true;
                    WeaponManager.instance.GetComponent <Bazuka>().CurrentSpare += 1;
                    if (SaveManager.instance.currentWeapon == WeaponEnum.Bazuka)
                    {
                        UIManager.instance.UpdateAmmo(WeaponManager.instance.GetComponent <Bazuka>().CurrentAmmo, WeaponManager.instance.GetComponent <Bazuka>().CurrentSpare);
                    }
                    item.OnPickUp();
                }
                else if (hit.transform.CompareTag("Weapon"))
                {
                    item.Collected = true;
                    SaveManager.instance.collected[item.Id] = true;
                    inventory.AddItem(item, "Weapon");
                }
            }
        }
    }
Пример #58
0
    private void RaycastDoor()
    {
        RaycastHit hit = CameraManager.GetCameraRaycast(player.GetStats().InteractRange);

        if (hit.transform)
        {
            if (Input.GetButtonDown("Interact"))
            {
                if (hit.transform.CompareTag("Interactable"))
                {
                    Door door = hit.transform.GetComponent <Door>();
                    if (door != null)
                    {
                        if (!door.needKey)
                        {
                            if (door.enterZone)
                            {
                                door.isOpened = true;
                                door.OnOpen();
                            }
                            else
                            {
                                door.OnEnter();
                            }
                        }
                        else if (door.needKey)
                        {
                            if (inventory.FindKeyItem(door.keyName) != null)
                            {
                                door.PlaySFX();
                                inventory.RemoveItem(inventory.FindKeyItem(door.keyName));
                                door.needKey = false;
                                //SaveManager.instance.UnlockDoor(door.id);

                                /*
                                 * if(door.id == 0)
                                 * {
                                 *  if (SaveManager.instance.firstTimeEvent[3])
                                 *  {
                                 *      FindObjectOfType<EventTrigger>().StartCon3();
                                 *  }
                                 * }
                                 */

                                if (door.enterZone)
                                {
                                    door.isOpened = true;
                                    door.OnOpen();
                                }
                                else
                                {
                                    door.OnEnter();
                                }
                            }
                            else
                            {
                                uiManager.UpdateSubtitle("คุณต้องใช้" + door.keyDisplay + " เพื่อดำเนินการต่อ");
                            }
                        }
                    }
                }
            }
        }
    }
Пример #59
0
 // Start is called before the first frame update
 void Start()
 {
     playerManager = GetComponent <PlayerManager>();
     cameraManager = Camera.main.GetComponent <CameraManager>();
 }
Пример #60
0
 void Awake()
 {
     singleton = this;
 }