Example #1
0
 void Awake()
 {
     // subscribe to events from within the TorchEvent
     torchEvent = GetComponent <TorchEvent>();
     torchEvent.onSignalEnabledEvent      += OpenDoor;
     torchEvent.onRequiredTorchLitEvent   += OnRequiredTorchLit;
     torchEvent.onRequiredTorchUnlitEvent += OnRequiredTorchUnlit;
 }
Example #2
0
 void Awake()
 {
     // subscribe to events from within the TorchEvent
     torchEvent = GetComponent <TorchEvent>();
     spikeTrap  = GetComponent <SpikeTrap>();
     torchEvent.onSignalEnabledEvent  += EnableSpike;
     torchEvent.onSignalDisabledEvent += DisableSpike;
 }
Example #3
0
    //run before Start()
    public bool SpawnTorch(TorchEvent torchEvent)
    {
        if (torchLocation != null)
        {
            GameObject newTorch = Instantiate(torchPrefab);
            newTorch.transform.rotation = torchLocation.transform.rotation;
            newTorch.transform.position = torchLocation.transform.position;
            torchEvent.AddRequiredTorch(newTorch.GetComponent <Torch>());

            //foreach(GameObject spike in spikeList)
            //    spike.GetComponent<TorchEvent>().AddRequiredTorch(newTorch.GetComponent<Torch>());

            return(true);
        }
        return(false);
    }
Example #4
0
    private void SpawnTorches(List <GameObject> roomList)
    {
        int        torchCount = 0;
        TorchEvent te         = bossRoomPrefab.transform.Find("Architecture").Find("doors").Find("Door").GetComponent <TorchEvent>();

        for (int i = roomList.Count - 1; i >= 0; i--)
        {
            MiscSpawn ms;
            if (ms = roomList[i].GetComponent <MiscSpawn>())
            {
                if (ms.SpawnTorch(te))
                {
                    torchCount++;
                }
                if (torchCount >= maxTorches)
                {
                    break;
                }
            }
        }
    }
Example #5
0
 void DisableSpike(TorchEvent torchEvent)
 {
     spikeTrap.shouldStayRetracted = true;
 }
Example #6
0
 void EnableSpike(TorchEvent torchEvent)
 {
     spikeTrap.shouldStayRetracted = false;
 }
Example #7
0
 void OpenDoor(TorchEvent torchEvent)
 {
     // TODO play an animation here instead.
     transform.position = finalPosition.position;
 }
Example #8
0
 void OnRequiredTorchUnlit(TorchEvent torchEvent, Torch torch)
 {
     // TODO show a visual representation of how many torches are lit, and how many remain
 }