Ejemplo n.º 1
0
    public void objectFinished(TriggeredObject ob)
    {
        if (isSequential)
        {
            currentObject++;

            if (currentObject < objectsAffected.Count)
            {
                objectsAffected [currentObject].doAction(this);
            }
            else
            {
                currentObject = 0;
                List <TriggeredObject> objectsToRemove = new List <TriggeredObject>();

                for (int i = 0; i < objectsAffected.Count; i++)
                {
                    if (!objectsAffected[i].getLoop())
                    {
                        objectsToRemove.Add(objectsAffected[i]);
                    }
                    else
                    {
                        objectsAffected[i].setIsTriggered(false);
                    }
                }

                for (int j = 0; j < objectsToRemove.Count; j++)
                {
                    objectsAffected.Remove(objectsToRemove[j]);
                }
            }
        }
        else
        {
            if (!ob.getLoop())
            {
                objectsAffected.Remove(ob);
            }
            else
            {
                ob.setIsTriggered(false);
            }
        }
    }
    public void objectFinished(TriggeredObject ob)
    {
        if (isSequential) {
            currentObject++;

            if (currentObject < objectsAffected.Count) {
                objectsAffected [currentObject].doAction (this);
            }
            else
            {
                currentObject = 0;
                List<TriggeredObject> objectsToRemove = new List<TriggeredObject>();

                for(int i = 0; i < objectsAffected.Count; i++)
                {
                    if(!objectsAffected[i].getLoop())
                    {
                        objectsToRemove.Add(objectsAffected[i]);
                    }
                    else
                    {
                        objectsAffected[i].setIsTriggered(false);
                    }
                }

                for(int j = 0; j < objectsToRemove.Count; j++)
                {
                    objectsAffected.Remove(objectsToRemove[j]);
                }
            }
        }
        else
        {
            if(!ob.getLoop())
            {
                objectsAffected.Remove(ob);
            }
            else
            {
                ob.setIsTriggered(false);
            }
        }
    }
Ejemplo n.º 3
0
    public void Activate(TriggeredObject[] triggeredObjects)
    {
        Bounds playerCheck = playerDetector.bounds;
        if (playerCheck.Contains(player.transform.position) && crystalsRevealed) {
            foreach (TriggeredObject t in triggeredObjects) {
                t.Trigger();
            }
        }
        /*
        crystalCounter++;
        crystalResetRemaining = crystalResetTimer;

        if (crystalCounter == 4) {
            foreach (TriggeredObject t in triggeredObjects) {
                t.Trigger();
                Debug.Log("YES!");
            }
        }
        */
    }