Esempio n. 1
0
    public CGameObject GetGameObject()
    {
        IntPtr      cPtr = testPINVOKE.CInventoryItem_GetGameObject(swigCPtr);
        CGameObject ret  = (cPtr == IntPtr.Zero) ? null : new CGameObject(cPtr, false);

        return(ret);
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
    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);
    }
Esempio n. 4
0
    /// <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);
    }
Esempio n. 5
0
    /// <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);
    }
Esempio n. 6
0
    public CGameObject GetGameObjectByEntityName(string Name)
    {
        IntPtr      cPtr = testPINVOKE.CGameObjectManager_GetGameObjectByEntityName(swigCPtr, Name);
        CGameObject ret  = (cPtr == IntPtr.Zero) ? null : new CGameObject(cPtr, false);

        return(ret);
    }
Esempio n. 7
0
        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;
        }
Esempio n. 8
0
 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]);
 }
Esempio n. 9
0
    /// <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);
    }
Esempio n. 10
0
 public void Update()
 {
     if (Amount > 0 && Enemy == null)
     {
         Enemy = CObjectManager.Instance.CreateInstance(EnemyType, Position.X, Position.Y, 20);
     }
     else if (Amount <= 0)
     {
         RemoveSpawner();
     }
 }
Esempio n. 11
0
 public void lookAt(CGameObject aGameObject, bool useCenter = true)
 {
     if (useCenter)
     {
         lookAt(aGameObject.getCenter());
     }
     else
     {
         lookAt(aGameObject.getPos());
     }
 }
Esempio n. 12
0
 public bool collides(CGameObject aGameObject)
 {
     if (CMath.dist(getX(), getY(), aGameObject.getX(), aGameObject.getY()) < (getRadius() + aGameObject.getRadius()))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 13
0
    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);
    }
Esempio n. 14
0
        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();
            }
        }
Esempio n. 15
0
    public CGameObject collides(CGameObject aGameObject)
    {
        for (int i = mArray.Count - 1; i >= 0; i--)
        {
            if (aGameObject.collides(mArray[i]))
            {
                return(mArray[i]);
            }
        }

        return(null);
    }
Esempio n. 16
0
    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;
         */
    }
Esempio n. 17
0
    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);
    }
Esempio n. 18
0
    /// <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;
    }
Esempio n. 19
0
 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);
     }
 }
Esempio n. 20
0
    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);
        }
    }
Esempio n. 21
0
        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);
        }
Esempio n. 22
0
    // 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;
    }
Esempio n. 23
0
    /// <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);
 }
Esempio n. 25
0
 public virtual void AddEffectToGameObject(CGameObject GameObject)
 {
     testPINVOKE.CEntityEffect_AddEffectToGameObject(swigCPtr, CGameObject.getCPtr(GameObject));
 }
Esempio n. 26
0
 private bool containsAudioSource(CGameObject aKey)
 {
     return(mAudioSources.ContainsKey(aKey));
 }
Esempio n. 27
0
 private void addAudioSource(CGameObject aKey, CAudioSource aProduct)
 {
     mAudioSources.Add(aKey, aProduct);
 }
Esempio n. 28
0
 public void UseItem(CGameObject GameObject, CInventoryItem Item)
 {
     testPINVOKE.CBuilding_UseItem__SWIG_2(swigCPtr, CGameObject.getCPtr(GameObject), CInventoryItem.getCPtr(Item));
 }
Esempio n. 29
0
 public void RemoveObstacle(CGameObject GameObject)
 {
     testPINVOKE.CGameObjectManager_RemoveObstacle(swigCPtr, CGameObject.getCPtr(GameObject));
 }
 public void Remove(CGameObject o)
 {
     List.Remove(o);
 }
Esempio n. 31
0
 public void UseItem(CGameObject GameObject)
 {
     testPINVOKE.CBuilding_UseItem__SWIG_3(swigCPtr, CGameObject.getCPtr(GameObject));
 }
Esempio n. 32
0
 public void AddBoxObstacle(CGameObject GameObject)
 {
     testPINVOKE.CGameObjectManager_AddBoxObstacle(swigCPtr, CGameObject.getCPtr(GameObject));
 }