public CGameObject GetGameObject() { IntPtr cPtr = testPINVOKE.CInventoryItem_GetGameObject(swigCPtr); CGameObject ret = (cPtr == IntPtr.Zero) ? null : new CGameObject(cPtr, false); return(ret); }
public CGameObject GetGameObject(SWIGTYPE_p_Entity entity) { IntPtr cPtr = testPINVOKE.CGameObjectManager_GetGameObject__SWIG_0(swigCPtr, SWIGTYPE_p_Entity.getCPtr(entity)); CGameObject ret = (cPtr == IntPtr.Zero) ? null : new CGameObject(cPtr, false); return(ret); }
public CGameObject CreateCustomObject(string MeshName) { IntPtr cPtr = testPINVOKE.CGameObjectManager_CreateCustomObject__SWIG_0(swigCPtr, MeshName); CGameObject ret = (cPtr == IntPtr.Zero) ? null : new CGameObject(cPtr, false); return(ret); }
/// <summary> /// Adds an Audio Source to the list managed by AudioManager. /// </summary> /// <param name="aObject"></param> public void addAudioSource(CGameObject aObject) { CAudioSource source = new CAudioSource(aObject); source.setAs3DSource(); addAudioSource(aObject, source); }
/// <summary> /// Used for 3D SFX, play at the objects AudioSource /// </summary> /// <param name="aObject"></param> /// <param name="aSoundName"></param> public void playFXAt(CGameObject aObject, string aSoundName) { AudioClip clip = getAudioClip(aSoundName); AudioSource source = getAudioSource(aObject).component; source.PlayOneShot(clip); }
public CGameObject GetGameObjectByEntityName(string Name) { IntPtr cPtr = testPINVOKE.CGameObjectManager_GetGameObjectByEntityName(swigCPtr, Name); CGameObject ret = (cPtr == IntPtr.Zero) ? null : new CGameObject(cPtr, false); return(ret); }
public void SetObjective(string objStr, float x, float y) { currentObjective = ObjectiveType.Reach; float h = CLevel.Instance.GetHeightAt(x, y, 999); Target = CObjectManager.Instance.CreateInstance(typeof(CCheckpoint), x, h, y); sObjectiveString = objStr; }
private CAudioSource getAudioSource(CGameObject aKey) { //@Fernando: Added null check in case the audiosource wasn't registered. -Mauri if (!mAudioSources.ContainsKey(aKey)) { return(null); } return(mAudioSources[aKey]); }
/// <summary> /// Adds an Audio Source to the list managed by AudioManager. /// </summary> /// <param name="aObject"></param> public CAudioSource addAudioSource(CGameObject aObject) { CAudioSource source = new CAudioSource(aObject); source.setAs3DSource(); addAudioSource(aObject, source); return(source); }
public void Update() { if (Amount > 0 && Enemy == null) { Enemy = CObjectManager.Instance.CreateInstance(EnemyType, Position.X, Position.Y, 20); } else if (Amount <= 0) { RemoveSpawner(); } }
public void lookAt(CGameObject aGameObject, bool useCenter = true) { if (useCenter) { lookAt(aGameObject.getCenter()); } else { lookAt(aGameObject.getPos()); } }
public bool collides(CGameObject aGameObject) { if (CMath.dist(getX(), getY(), aGameObject.getX(), aGameObject.getY()) < (getRadius() + aGameObject.getRadius())) { return(true); } else { return(false); } }
public CGameObject CreateCustomObject(string MeshName, string Name, SWIGTYPE_p_Vector3 Pos) { IntPtr cPtr = testPINVOKE.CGameObjectManager_CreateCustomObject__SWIG_1(swigCPtr, MeshName, Name, SWIGTYPE_p_Vector3.getCPtr(Pos)); CGameObject ret = (cPtr == IntPtr.Zero) ? null : new CGameObject(cPtr, false); if (testPINVOKE.SWIGPendingException.Pending) { throw testPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public void UpdateObjective() { if (currentObjective == ObjectiveType.Elimination) { if (Target == null || !CObjectManager.Instance.IndexExists(Target.iIndex)) { Console.WriteLine("objective complete!"); Target = null; isActive = false; } } else if (currentObjective == ObjectiveType.Reach) { if (Target == null || !CObjectManager.Instance.IndexExists(Target.iIndex)) { Console.WriteLine("objective complete!"); Target = null; isActive = false; } } else if (currentObjective == ObjectiveType.Survival) { if (Timer <= 0) { Console.WriteLine("objective complete!"); isActive = false; } Timer--; } else if (currentObjective == ObjectiveType.Event) { bool dialogueOn = (currentDialog != null && CAudioManager.Instance.IsSoundPlaying(currentDialog)); if (TextInd < DialogSoundBytes.Count && !dialogueOn) { currentDialog = CAudioManager.Instance.PlaySound(DialogSoundBytes[TextInd]); TextInd++; } else if (TextInd >= DialogSoundBytes.Count && !dialogueOn) { Console.WriteLine("objective complete!"); Target = null; isActive = false; } } foreach (EnemySpawner e in spawnerList) { e.Update(); } }
public CGameObject collides(CGameObject aGameObject) { for (int i = mArray.Count - 1; i >= 0; i--) { if (aGameObject.collides(mArray[i])) { return(mArray[i]); } } return(null); }
public CAudioComponent(CGameObject aGameObject) { owner = aGameObject; gameObject = new GameObject(); // Debug. /* * SpriteRenderer renderer = gameObject.AddComponent<SpriteRenderer>(); * renderer.sprite = Resources.Load<Sprite>("Sprites/debug/frame"); * renderer.color = Color.red; */ }
public List <CGameObject> collidesList(CGameObject aGameObject) { List <CGameObject> results = new List <CGameObject>(); for (int i = mArray.Count - 1; i >= 0; i--) { if (aGameObject.collides(mArray[i])) { results.Add(mArray[i]); } } return(results); }
/// <summary> /// Sets the Cameras Audio Listener and Audio Sources for Music and SFX. /// </summary> /// <param name="aObject"></param> public void setAudioListener(CGameObject aObject) { if (mAudioListener == null) { mAudioListener = new CAudioListener(aObject); } mListenerSourceFX = new CAudioSource(aObject); mListenerSourceFX.setAs2DSource(); mListenerSourceMusic = new CAudioSource(aObject); mListenerSourceMusic.setAs2DSource(); mListenerSourceMusic.component.loop = true; }
public bool collidesRect(CGameObject aGameObject) { if (getX() + getLeftOffsetBoundingBox() < aGameObject.getX() + aGameObject.getWidth() - aGameObject.getRightOffsetBoundingBox() && getX() + getWidth() - getRightOffsetBoundingBox() > aGameObject.getX() + aGameObject.getLeftOffsetBoundingBox() && getY() + getTopOffsetBoundingBox() < aGameObject.getY() + aGameObject.getHeight() - aGameObject.getBottomOffsetBoundingBox() && getHeight() + getY() - getBottomOffsetBoundingBox() > aGameObject.getY() + aGameObject.getTopOffsetBoundingBox()) { return(true); } else { return(false); } }
public hitBox(CGameObject caster, int sizeX, int sizeY, int positionX, int positionY, int frameDelay, int duration, int team, bool recursivo = false, int cantDeRepeticiones = 0) { entityCasting = caster; width = sizeX; height = sizeY; setXY(caster.getX() + positionX, caster.getY() + positionY); delay = frameDelay; boxDuration = duration; if (recursivo) { boxRecursivo = recursivo; repeticiones = cantDeRepeticiones; } setImage(Resources.Load <Sprite>("Sprites/ui/pixel")); setSortingLayerName("Player"); setSortingOrder(20); setColor(Color.blue); setAlpha(0.5f); setName(caster + " hitBox"); posX = positionX; posY = positionY; setXY(-width, -height); setScaleX(sizeX); setScaleY(sizeY); if (delay == 0) { setState(STATE_ACTING); } else { setState(STATE_WAITING); } }
public List <Vector3> GetObjectivePositions() { List <Vector3> vectorList = new List <Vector3>(); if (pObjectiveList.Count > 0) { Objective o = pObjectiveList[0]; if (o.isActive) { CGameObject Target = o.GetTarget(); if (Target != null) { vectorList.Add(new Vector3(Target.x, Target.z, Target.y)); } } } return(vectorList); }
// Fonction qui modifie le mesh //------------------------------------------------------------------------------- /// //------------------------------------------------------------------------------- private void UpdateSightMesh() { // prepare beams setDirection(); // Lance les rayons pour placer les vertices le plus loin possible for (int i = 0; i < precision; i++) { Vector3 dir = m_Transform.TransformDirection(directions[i]); // repere objet RaycastHit hit; float dist = distance; if (Physics.Raycast(m_Transform.position, dir, out hit, distance, mask)) // Si on touche, on rétrécit le rayon { CGameObject objet = hit.collider.gameObject.GetComponent <CGameObject>(); if (!hit.collider.gameObject.tag.Equals("player") && hit.collider.gameObject.GetComponent <CGameObject>() != null) { dist = hit.distance; //objet.SetVisible(); } } if (debug) { Debug.DrawRay(m_Transform.position, dir * dist); } // Positionnement du vertex points[i] = dir * dist; points[i + precision] = Vector3.zero; } // On réaffecte les vertices sightMesh.vertices = points; sightMesh.RecalculateNormals(); // normales doivent être calculé pour tout changement // du tableau vertices, même si on travaille sur un plan*/ //translate le centre a la position du player!!! J'AI PASSE 3 PUTAINS DE JOUR POUR TROUVER QU'IL FALLAIT FAIRE LE CONE EN (0,0) ET LE TRANSLATER ENSUITE!!! m_gameObject.transform.position = m_Transform.position; }
/// <summary> /// Used for 3D sounds. Plays a random sound at a desired Objects location. /// Example, PlayRandomRange(object, "foot_pasto_", 0, 11); /// Assumes files to be named: sound_name_number /// </summary> /// <param name="aObject">Object to play at</param> /// <param name="aSoundName">Prefix of sound name</param> /// <param name="aStart">First file starting number</param> /// <param name="aEnd">Last file starting number</param> public void playRandomRangeAt(CGameObject aObject, string aSoundName, int aStart, int aEnd) { mTestTimer += Time.deltaTime; //@Fernando: Added null check in case the audiosource wasn't registered. -Mauri CAudioSource csource = getAudioSource(aObject); if (csource == null) { return; } AudioSource source = csource.component; AudioClip clip = getAudioClip(aSoundName + CMath.randomIntBetween(aStart, aEnd)); if (mTestTimer + CMath.randomFloatBetween(-0.1f, 0.1f) > 0.3f) { // Apply random volume. float vol = CMath.randomFloatBetween(0.7f, 1.0f); // Apply random pitch. source.pitch = CMath.randomFloatBetween(0.75f, 1.25f); source.PlayOneShot(clip, vol); mTestTimer = 0.0f; } }
public void Add(CGameObject o) { List.Add(o); }
public virtual void AddEffectToGameObject(CGameObject GameObject) { testPINVOKE.CEntityEffect_AddEffectToGameObject(swigCPtr, CGameObject.getCPtr(GameObject)); }
private bool containsAudioSource(CGameObject aKey) { return(mAudioSources.ContainsKey(aKey)); }
private void addAudioSource(CGameObject aKey, CAudioSource aProduct) { mAudioSources.Add(aKey, aProduct); }
public void UseItem(CGameObject GameObject, CInventoryItem Item) { testPINVOKE.CBuilding_UseItem__SWIG_2(swigCPtr, CGameObject.getCPtr(GameObject), CInventoryItem.getCPtr(Item)); }
public void RemoveObstacle(CGameObject GameObject) { testPINVOKE.CGameObjectManager_RemoveObstacle(swigCPtr, CGameObject.getCPtr(GameObject)); }
public void Remove(CGameObject o) { List.Remove(o); }
public void UseItem(CGameObject GameObject) { testPINVOKE.CBuilding_UseItem__SWIG_3(swigCPtr, CGameObject.getCPtr(GameObject)); }
public void AddBoxObstacle(CGameObject GameObject) { testPINVOKE.CGameObjectManager_AddBoxObstacle(swigCPtr, CGameObject.getCPtr(GameObject)); }