Пример #1
0
        public void Execute(Entity entity, int index, ref Ground ground, ref TopButton topButton, ref Translation translation)
        {
            var topButtonMove = moveData[entity];

            if (topButtonMove.forceMove) // Has already been started
            {
                return;
            }
            if (ground.playerWasHere)
            {
                SoundManager.GetInstance().QueueAudio(translation.Value, "buttonPress");
                // Get the entity component to activate (could be on a door)
                ButtonActivation activationDataEntity = activationData[topButton.toBeActivated];
                activationDataEntity.isActivated        = true;
                activationData[topButton.toBeActivated] = activationDataEntity;
                // If two things should be activated - it will be done here
                if (topButton.hasTwoActivations)
                {
                    ButtonActivation activationDataEntityTwo = activationData[topButton.toBeActivatedToo];
                    activationDataEntityTwo.isActivated        = true;
                    activationData[topButton.toBeActivatedToo] = activationDataEntityTwo;
                }

                // Move both parts of the button
                topButtonMove.forceMove = true;
                moveData[entity]        = topButtonMove;
                Move data = moveData[topButton.lowerButton];
                data.forceMove = true;
                moveData[topButton.lowerButton] = data;
            }
        }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        timer -= Time.deltaTime;
        //if (num_doors == current_num_doors) {

        //    current_num_doors += 1; //para cortarlo todo
        //    //esto antes estaba en el trigger pero no funcionaba pork para que enviase doors a ba tenia que volver a detectar trigger enter
        //}
        if (timer <= 0)
        {
            ButtonActivation ba = GetComponentInParent <ButtonActivation>();
            ba.doors     = doors;
            ba.colliders = colliders;
            Destroy(gameObject);
        }
    }
Пример #3
0
 // Start is called before the first frame update
 void Start()
 {
     button = GetComponentInParent<ButtonActivation>();
 }