Beispiel #1
0
 //enforcing AI check
 void Start()
 {
     if ((m_tTractor & Tractor.AI) != 0 && m_ai == null)
     {
         m_ai = this.gameObject.GetComponent <AIPlay>();
     }
 }
Beispiel #2
0
 void Awake()
 {
     if ((m_tTractor & Tractor.AI) != 0 && m_ai == null)
     {
         m_ai = this.gameObject.GetComponent <AIPlay>();
     }
     m_gLevelStates = GameStates.LVL1 | GameStates.LVL2 | GameStates.LVL3;
 }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        if ((m_tTractor & Tractor.AI) == 0)
        {
            if (GameManager.Instance.CurrentState == GameStates.LVL1 && LevelManager.TutorialTime)
            {
                m_bConfirm = m_ConfirmName != "" ? Input.GetButtonDown(m_ConfirmName) : false;
            }
            //TODO: Check how to use bitfields effectively
            else if ((GameManager.Instance.CurrentState & m_gLevelStates) != 0 &&
                     !LevelManager.TutorialTime)
            {
                //It may be the case for creating a dead zone for acceleration
                m_fAccel = Input.GetAxis(m_VerticalAxisName) + m_fForwardOffset;
                m_fTurn  = Input.GetAxis(m_HorizontalAxisName);

                //Brakes have to be applied every frame the brakes are pulled
                m_bBrake = Input.GetButton(m_BrakeName);

                m_bPause   = m_PauseName != "" ? Input.GetButtonDown(m_PauseName) : false;
                m_bConfirm = m_ConfirmName != "" ? Input.GetButtonDown(m_ConfirmName) : false;
                m_bCancel  = m_CancelName != "" ? Input.GetButtonDown(m_CancelName) : false;
            }
        }
        else   //for whatever reason, this is running even when the tractors are NOT AI
               //AI-wise, only movement input is relevant
        {
            if (m_ai)
            {
                m_fAccel = m_ai.Accelerate();
                m_fTurn  = m_ai.Steer();
                m_bBrake = m_ai.Brake();
            }
            else
            {
                m_ai = this.gameObject.GetComponent <AIPlay>();
            }
        }
    }
Beispiel #4
0
 private void Start()
 {
     boardController = BoardController.Instance;
     instance        = this;
 }
 // Start is called before the first frame update
 void Start()
 {
     m_ai = m_tTarget.gameObject.GetComponent <AIPlay>();
     m_im.SetTractor(m_tractor);
 }
Beispiel #6
0
 public AIPlayer(LevelController owner, Symbol symbol, Commander commander, string name) : base(owner, symbol, commander, name)
 {
     aIPlay     = AIPlay.Instance;
     timeToPlay = TIME_TO_PLAY;
 }