Пример #1
0
 void PerformAction(int actionNo)
 {
     if (actionNo == 0)
     {
         print("do nothing");
     }
     else if (actionNo == 1)
     {
         // m_timerScript.ChangeTime(5);
         // m_timerScript.countingDown = true;
     }
     else if (actionNo == 2)
     {
         m_blackoutScript.EnterBlackout(10);
     }
     else if (actionNo == 3)
     {
         m_robotBodyScript.SwitchesSet();
     }
     else if (actionNo == 4)
     {
         m_powerSent = 20;
         PowerExchange();
         m_powerSent = -20;
         Invoke("PowerExchange", 10f);
     }
     else if (actionNo == 5)
     {
         m_powerSent = -20;
         PowerExchange();
         m_powerSent = 20;
         Invoke("PowerExchange", 10f);
     }
     else if (actionNo == 6)
     {
         doorToggleInstantiateScript.AllDoorsAreLocked();
         doorToggleInstantiateScript.LockedOutAction();
         m_doorControllerScript.LockAllDoors();
     }
     else if (actionNo == 7)
     {
         int randObj = Random.Range(0, m_poweredObjects.Length);
         int randPow = Random.Range(0, m_powerIncreased.Length);
         m_aiPowerScript.ChangePowerValues(m_poweredObjects[randObj], m_powerIncreased[randPow]);
     }
 }
Пример #2
0
    /*
     * void Switches()
     * {
     *  if (m_switchOne)
     *  {
     *      SwitchOneOn();
     *  }
     *  else
     *  {
     *      SwitchOneOff();
     *  }
     * }
     *
     * void SwitchOneOn()
     * {
     *  if (m_switchTwo)
     *  {
     *      if (m_switchThree)
     *      {
     *          m_currentNumber = m_actionNumber[0];
     *      }
     *      else
     *      {
     *          m_currentNumber = m_actionNumber[1];
     *      }
     *  }
     *  else
     *  {
     *      if (m_switchThree)
     *      {
     *          m_currentNumber = m_actionNumber[2];
     *      }
     *      else
     *      {
     *          m_currentNumber = m_actionNumber[3];
     *      }
     *  }
     *  print(m_currentNumber);
     * }
     *
     * void SwitchOneOff()
     * {
     *  if (m_switchTwo)
     *  {
     *      if (m_switchThree)
     *      {
     *          m_currentNumber = m_actionNumber[4];
     *      }
     *      else
     *      {
     *          m_currentNumber = m_actionNumber[5];
     *      }
     *  }
     *  else
     *  {
     *      if (m_switchThree)
     *      {
     *          m_currentNumber = m_actionNumber[6];
     *      }
     *      else
     *      {
     *          m_currentNumber = m_actionNumber[7];
     *      }
     *  }
     *  print(m_currentNumber);
     * }
     */

    public void Interact()
    {
        m_buttonAudioSource.Play();
        m_buttonAnimator.SetTrigger("Pressed");
        if (m_currentNumber == 0)
        {
            print("do nothing");
        }
        else if (m_currentNumber == 1)
        {
            //m_timerScript.ChangeTime(5);
            //m_timerScript.countingDown = true;
        }
        else if (m_currentNumber == 2)
        {
            m_blackoutScript.EnterBlackout(10);
        }
        else if (m_currentNumber == 3)
        {
            m_robotBodyScript.SwitchesSet();
        }
        else if (m_currentNumber == 4)
        {
            m_powerSent = 20;
            PowerExchange();
            m_powerSent = -20;
            Invoke("PowerExchange", 10f);
        }
        else if (m_currentNumber == 5)
        {
            m_powerSent = -20;
            PowerExchange();
            m_powerSent = 20;
            Invoke("PowerExchange", 10f);
        }
        else if (m_currentNumber == 6)
        {
            doorToggleInstantiateScript.AllDoorsAreLocked();
            doorToggleInstantiateScript.LockedOutAction();
            m_doorControllerScript.LockAllDoors();
        }
        else if (m_currentNumber == 7)
        {
            m_aiPowerScript.ChangePowerValues(m_poweredObjects[m_randObjects], m_powerIncreased[m_randPower]);
            if (m_poweredObjects[m_randObjects] == "Lights")
            {
                m_lightControllerScript.CurrentLightPower(m_powerIncreased[m_randPower]);
            }
            else if (m_poweredObjects[m_randObjects] == "Doors")
            {
                m_doorControllerScript.CurrentDoorPower(m_powerIncreased[m_randPower]);
            }
            else if (m_poweredObjects[m_randObjects] == "Cameras")
            {
                m_cameraController.CurrentCameraPower(m_powerIncreased[m_randPower]);
            }
        }

        if (m_switchPostionInt[0] == m_goalSwitchPositions[0] && m_switchPostionInt[1] == m_goalSwitchPositions[1] && m_switchPostionInt[2] == m_goalSwitchPositions[2])
        {
            agentObjectives.SwitchPositions(0, true);
        }
    }