public FMOD.Studio.ParameterInstance getParameter(string name)
    {
        FMOD.Studio.ParameterInstance param = null;
        ERRCHECK(evt.getParameter(name, out param));

        return(param);
    }
    /// <summary>
    /// Gets the parameter.
    /// </summary>
    /// <param name="name">The name.</param>
    /// <returns></returns>
    public FMOD.Studio.ParameterInstance GetParameter(string name)
    {
        FMOD.Studio.ParameterInstance param = null;
        Logger.ErrorCheck(evt.GetParameter(name, out param));

        return(param);
    }
 private void InitMusic()
 {
     eMusic = FMODUtility.GetEvent(path);
     pMood = FMODUtility.GetParameter(eMusic, MOOD_PARAMETER);
     pState = FMODUtility.GetParameter(eMusic, STATE_PARAMETER);
     pTrack = FMODUtility.GetParameter(eMusic, TRACK_PARAMETER);
 }
Example #4
0
 public RESULT getParameter(string name, out ParameterInstance instance)
 {
     using (StringHelper.ThreadSafeEncoding threadSafeEncoding = StringHelper.GetFreeHelper())
     {
         return(FMOD_Studio_EventInstance_GetParameter(handle, threadSafeEncoding.byteFromStringUTF8(name), out instance.handle));
     }
 }
 public static ParameterInstance FromFmod(FMOD.Studio.ParameterInstance parameterInstance)
 {
     if (parameterInstance == null)
     {
         throw new ArgumentNullException("parameterInstance");
     }
     return(new ParameterInstance(parameterInstance));
 }
Example #6
0
    void Awake() {

       
        resources = new GameObject[7];
        
        //load buildings that can be spawned
        resources[0] = Resources.Load("Model Prefabs/Palisade") as GameObject; //0
        resources[1] = Resources.Load("Model Prefabs/GateHouse") as GameObject; //1
        resources[2] = Resources.Load("Model Prefabs/ChiefHall") as GameObject; //2
        resources[3] = Resources.Load("Model Prefabs/HuntersHut") as GameObject; //3
        resources[4] = Resources.Load("Model Prefabs/WoodcuttersHut") as GameObject; //4
        resources[5] = Resources.Load("Farm/Cow") as GameObject; //5
        resources[6] = Resources.Load("Farm/Sheep") as GameObject; //6


        //load particle effects
        destroyParticles = Resources.Load("Particle Effects/DestroyParticles") as GameObject;

        if (wallsLeft == null)
        {
            Debug.Log("NULL LEFT");
        }

        if(wallsRight == null)
        {
            Debug.Log("NULL RIGHT");
        }

        //get star rating script
        starManager = GameObject.Find("StarRating").GetComponent<StarRating>(); //GameObject.FindGameObjectWithTag("StarRatingUI").GetComponent<StarRating>();

        //load transforms of build tiles
        positions.AddRange(GameObject.FindGameObjectsWithTag("BuildLocation"));
        
        //spawn Gate house
        SpawnGateHouse();

        //spawn Chiefs Hut
        SpawnChiefHut();

        //spawn buildings
        WorldSpawn();

        //lookAt.position = new Vector3(lookAt.position.x, Terrain.activeTerrain.SampleHeight(lookAt.position), lookAt.position.z);

        foreach(GameObject i in positions)
        {
            i.transform.position = new Vector3(i.transform.position.x, Terrain.activeTerrain.SampleHeight(i.transform.position), i.transform.position.z);
        }


        starRatingAudioPar_ = MusicManager.musicManager.GetStarRatingParameter();

        starRatingAudioPar_.setValue(starRating);
        
    }
Example #7
0
 public RESULT getParameter(string name, out ParameterInstance instance)
 {
     instance = null;
     IntPtr raw = 0;
     RESULT rESULT = EventInstance.FMOD_Studio_EventInstance_GetParameter(this.rawPtr, Encoding.UTF8.GetBytes(name + '\0'), out raw);
     if (rESULT != RESULT.OK)
     {
         return rESULT;
     }
     instance = new ParameterInstance(raw);
     return rESULT;
 }
    // Use this for initialization
    void Start()
    {
        GetComponent<FMOD_StudioEventEmitter> ().StartEvent ();
        levelProgress = GetComponent<FMOD_StudioEventEmitter> ().getParameter ("level_progress");

        GetComponent<Camera> ().orthographicSize = level.GetComponent<MeshRenderer> ().bounds.extents.y;
        float halfWidth = GetComponent<Camera> ().aspect * GetComponent<Camera> ().orthographicSize;
        minX = level.GetComponent<MeshRenderer>().bounds.min.x + halfWidth;
        maxX = level.GetComponent<MeshRenderer>().bounds.max.x - halfWidth;
        targetY = level.position.y - level.GetComponent<MeshRenderer>().bounds.extents.y;
        transform.position = new Vector3 (Mathf.Clamp (player.position.x, minX, maxX), targetY, transform.position.z);
        GameObject.Find ("Background").GetComponent<BackgroundController>().SetupCam ();
    }
Example #9
0
        public RESULT getDescription(out PARAMETER_DESCRIPTION description)
        {
            description = default(PARAMETER_DESCRIPTION);
            PARAMETER_DESCRIPTION_INTERNAL pARAMETER_DESCRIPTION_INTERNAL;
            RESULT rESULT = ParameterInstance.FMOD_Studio_ParameterInstance_GetDescription(this.rawPtr, out pARAMETER_DESCRIPTION_INTERNAL);

            if (rESULT != RESULT.OK)
            {
                return(rESULT);
            }
            pARAMETER_DESCRIPTION_INTERNAL.assign(out description);
            return(rESULT);
        }
Example #10
0
        public RESULT getParameter(string name, out ParameterInstance instance)
        {
            instance = null;
            IntPtr raw    = 0;
            RESULT rESULT = EventInstance.FMOD_Studio_EventInstance_GetParameter(this.rawPtr, Encoding.UTF8.GetBytes(name + '\0'), out raw);

            if (rESULT != RESULT.OK)
            {
                return(rESULT);
            }
            instance = new ParameterInstance(raw);
            return(rESULT);
        }
Example #11
0
        public RESULT getParameterByIndex(int index, out ParameterInstance instance)
        {
            instance = null;
            IntPtr raw    = 0;
            RESULT rESULT = EventInstance.FMOD_Studio_EventInstance_GetParameterByIndex(this.rawPtr, index, out raw);

            if (rESULT != RESULT.OK)
            {
                return(rESULT);
            }
            instance = new ParameterInstance(raw);
            return(rESULT);
        }
Example #12
0
    // Use this for initialization
    void Start()
    {
        GetComponent <FMOD_StudioEventEmitter> ().StartEvent();
        levelProgress = GetComponent <FMOD_StudioEventEmitter> ().getParameter("level_progress");

        GetComponent <Camera> ().orthographicSize = level.GetComponent <MeshRenderer> ().bounds.extents.y;
        float halfWidth = GetComponent <Camera> ().aspect *GetComponent <Camera> ().orthographicSize;

        minX               = level.GetComponent <MeshRenderer>().bounds.min.x + halfWidth;
        maxX               = level.GetComponent <MeshRenderer>().bounds.max.x - halfWidth;
        targetY            = level.position.y - level.GetComponent <MeshRenderer>().bounds.extents.y;
        transform.position = new Vector3(Mathf.Clamp(player.position.x, minX, maxX), targetY, transform.position.z);
        GameObject.Find("Background").GetComponent <BackgroundController>().SetupCam();
    }
Example #13
0
	//the start access and saves a few "pointers" to the necessary scrips and variables

	//(this is to provide shortcuts to what we want to access and/or change)
	void Start(){
		try{
		m_Emitter = gameObject.GetComponent<FMOD_StudioEventEmitter> ();
		}catch{
			Debug.LogWarning("No Emitter attached to this object, i guess i have to do EVERYTHING myself");
			//AttachFmodEmitter();
		}

		surfaceTexture = gameObject.GetComponent<GetDominantTexture> ();

		if(m_Parameter == null){
			try{
				m_Parameter = m_Emitter.getParameter("Surface");
			} catch  {
				Debug.LogWarning("FMOD parameter failed, will try again");
				//TryGetParameterAgain();
			}
		}
	}
            public RESULT getParameterByIndex(int index, out ParameterInstance instance)
            {
                RESULT result = RESULT.OK;
                IntPtr parameterinstanceraw = new IntPtr();

                instance = null;

                try
                {
                    result = FMOD_Studio_EventInstance_GetParameterByIndex(rawPtr, index, out parameterinstanceraw);
                }
                catch
                {
                    result = RESULT.ERR_INVALID_PARAM;
                }
                if (result != RESULT.OK)
                {
                    return(result);
                }
                instance = new ParameterInstance();
                instance.setRaw(parameterinstanceraw);

                return(result);
            }
            public RESULT getParameter(string name, out ParameterInstance instance)
            {
                RESULT result = RESULT.OK;
                IntPtr parameterinstanceraw = new IntPtr();

                instance = null;

                try
                {
                    result = FMOD_Studio_EventInstance_GetParameter(rawPtr, Encoding.UTF8.GetBytes(name + Char.MinValue), out parameterinstanceraw);
                }
                catch
                {
                    result = RESULT.ERR_INVALID_PARAM;
                }
                if (result != RESULT.OK)
                {
                    return(result);
                }
                instance = new ParameterInstance();
                instance.setRaw(parameterinstanceraw);

                return(result);
            }
    IEnumerator VaryWindParam(ParameterInstance param)
    {
        float currValue;
        param.getValue(out currValue);

        // random range is based on the current settings in FMOD
        float newValue = Random.Range(0, 10);
        float amountOfChange = Mathf.Abs(currValue - newValue);

        // a larger change in speed should be applied over a longer period of time
        float changeTime = amountOfChange * 3;
        float elapsedTime = 0;

        while (elapsedTime < changeTime)
        {
            currValue = Mathf.Lerp(currValue, newValue, (elapsedTime / changeTime));
            param.setValue(currValue);
            elapsedTime += Time.deltaTime;

            yield return null;
        }

        StartCoroutine(VaryWindParam(param));
    }
Example #17
0
 private void StopOnFireEvent()
 {
     if (this.onFireEventInstance != null)
     {
         UnityUtil.ERRCHECK(this.onFireEventInstance.stop(STOP_MODE.ALLOWFADEOUT));
         UnityUtil.ERRCHECK(this.onFireEventInstance.release());
         this.onFireEventInstance = null;
         this.onFireHealthParameter = null;
     }
 }
Example #18
0
 private void StopBurningEvent()
 {
     if (this.burningEventInstance != null)
     {
         UnityUtil.ERRCHECK(this.burningEventInstance.stop(STOP_MODE.ALLOWFADEOUT));
         this.burningEventInstance = null;
         this.sizeParameter = null;
         this.flareUpParameter = null;
     }
 }
Example #19
0
	void Start() {
		if(m_MusicEmitter != null) {
			m_ParameterInstance = m_MusicEmitter.getParameter(m_Parameter);
		}
	}
 private void SetFmodAsset(FMODAsset sound)
 {
     path = sound;
     eSound = FMODUtility.GetEvent(path);
     pState = FMODUtility.GetParameter(eSound, STATE_PARAMETER);
     pVolume = FMODUtility.GetParameter(eSound, VELOCITY_PARAMETER);
     pMood = FMODUtility.GetParameter(eSound, MOOD_PARAMETER);
 }
Example #21
0
 protected override bool isValidInternal()
 {
     return(ParameterInstance.FMOD_Studio_ParameterInstance_IsValid(this.rawPtr));
 }
Example #22
0
 public RESULT setValue(float value)
 {
     return(ParameterInstance.FMOD_Studio_ParameterInstance_SetValue(this.rawPtr, value));
 }
 private ParameterInstance(FMOD.Studio.ParameterInstance parameterInstance)
     : this()
 {
     FmodParameterInstance = parameterInstance;
 }
 private void OnDestroy()
 {
     if (FMOD_StudioEventEmitter.isShuttingDown)
     {
         return;
     }
     UnityUtil.Log("Destroy called");
     if (this.IsEventInstanceValid())
     {
         if (this.getPlaybackState() != PLAYBACK_STATE.STOPPED)
         {
             UnityUtil.Log("Release evt: '" + this.path + "'");
             this.ERRCHECK(this.evt.stop(STOP_MODE.IMMEDIATE));
         }
         this.ERRCHECK(this.evt.release());
         this.evt = null;
         this.timeParameter = null;
         this.windParameter = null;
     }
     this.preStartAction = null;
     this.eventDescription = null;
 }
Example #25
0
 public RESULT getParameterByIndex(int index, out ParameterInstance instance)
 {
     return(FMOD_Studio_EventInstance_GetParameterByIndex(handle, index, out instance.handle));
 }
Example #26
0
        public RESULT getParameter(string name, out ParameterInstance instance)
        {
            instance = null;

            IntPtr newPtr = new IntPtr();
            RESULT result = FMOD_Studio_EventInstance_GetParameter(rawPtr, Encoding.UTF8.GetBytes(name + Char.MinValue), out newPtr);
            if (result != RESULT.OK)
            {
                return result;
            }
            instance = new ParameterInstance(newPtr);

            return result;
        }
Example #27
0
	public void UpdateSFXParam(EventInstance soundEffect, ParameterInstance param, float value)
	{

	}
Example #28
0
 public RESULT getParameterByIndex(int index, out ParameterInstance instance)
 {
     instance = null;
     IntPtr raw = 0;
     RESULT rESULT = EventInstance.FMOD_Studio_EventInstance_GetParameterByIndex(this.rawPtr, index, out raw);
     if (rESULT != RESULT.OK)
     {
         return rESULT;
     }
     instance = new ParameterInstance(raw);
     return rESULT;
 }
Example #29
0
 public RESULT getValue(out float value)
 {
     return(ParameterInstance.FMOD_Studio_ParameterInstance_GetValue(this.rawPtr, out value));
 }
Example #30
0
        public RESULT getParameterByIndex(int index, out ParameterInstance instance)
        {
            instance = null;

            IntPtr newPtr = new IntPtr();
            RESULT result = FMOD_Studio_EventInstance_GetParameterByIndex(rawPtr, index, out newPtr);
            if (result != RESULT.OK)
            {
                return result;
            }
            instance = new ParameterInstance(newPtr);

            return result;
        }
Example #31
0
	//This function is obsolete and do not function the way i want
	private void TryGetParameterAgain()
	{
		AttachFmodEmitter ();
		try{
			m_Parameter = m_Emitter.getParameter("Surface");
		}catch{
			Debug.Log("Get parameter failed Again");
		}
	}