// Use this for initialization
 public void Start()
 {
     mAccel = new Vector3(0.0f, 0.0f, 0.0f);
     mBody = GetComponent<Rigidbody>();
     mController = GetComponent<UserInputComponent>();
     mAttribs = GetComponent<PlayerAttributes>();
     IsAirborne = false;
 }
 public override void Dispose()
 {
     if (IsDisposed)
     {
         return;
     }
     base.Dispose();
     //此处填写释放逻辑,但涉及Entity的操作,请放在Destroy中
     m_UserInputComponent = null;;
 }
 public override void Dispose()
 {
     if (this.IsDisposed)
     {
         return;
     }
     base.Dispose();
     m_UserInputComponent           = null;
     m_MouseTargetSelectorComponent = null;
 }
Esempio n. 4
0
        public SnakeGame(
            BoardInfo boardInfo, SnakeInfo snakeInfo,
            AppleInfo appleInfo, TextOutputInfo textOutputInfo)
        {
            // --- support e.g. hearts
            Console.OutputEncoding = System.Text.Encoding.Unicode;
            m_listGameObjects      = new List <IGameObject>();
            m_userInput            = new UserInputComponent();
            m_soundComponent       = new SoundComponent();
            m_storageBestResult    = new BestResultStorage(Constants.BEST_RESULTS_FILE);


            m_snakeInfo      = snakeInfo;      //readonly
            m_appleInfo      = appleInfo;      //readonly
            m_textOutputInfo = textOutputInfo; //readonly
            m_boardInfo      = boardInfo;
        }
 public void Awake()
 {
     this.heroTransformComponent = this.GetParent <HotfixUnit>().m_ModelUnit.GetComponent <HeroTransformComponent>();
     this.userInputComponent     = ETModel.Game.Scene.GetComponent <UserInputComponent>();
     this.m_CDComponent          = ETModel.Game.Scene.GetComponent <CDComponent>();
     m_QCDInfo          = ReferencePool.Acquire <CDInfo>();
     m_QCDInfo.Interval = 5000;
     m_QCDInfo.Name     = "QCD";
     m_WCDInfo          = ReferencePool.Acquire <CDInfo>();
     m_WCDInfo.Interval = 7000;
     m_WCDInfo.Name     = "WCD";
     m_ECDInfo          = ReferencePool.Acquire <CDInfo>();
     m_ECDInfo.Interval = 10000;
     m_ECDInfo.Name     = "ECD";
     m_CDComponent.AddCDData(this.Entity.Id, m_QCDInfo);
     m_CDComponent.AddCDData(this.Entity.Id, m_WCDInfo);
     m_CDComponent.AddCDData(this.Entity.Id, m_ECDInfo);
 }
Esempio n. 6
0
        public override void HandleUserInputs()
        {
            ConsoleKeyInfo?keyInfo = m_userInput.GetKey();

            if (keyInfo.HasValue)
            {
                m_key = keyInfo.Value.KeyChar;
            }

            m_directionSnakeHead = UserInputComponent.GetDirection(keyInfo);

            if ((m_snake.HeadDirection == null) &&
                (m_directionSnakeHead != null))
            {
                //first time user click on arrows so clear instructions
                m_textOutput.Clear();
            }
            if (m_directionSnakeHead.HasValue)
            {
                // --- direty is handled inside
                m_snake.HeadDirection = m_directionSnakeHead.Value;
            }
        }
 public void Awake()
 {
     this.heroTransformComponent = this.GetParent <HotfixUnit>().m_ModelUnit.GetComponent <HeroTransformComponent>();
     this.userInputComponent     = ETModel.Game.Scene.GetComponent <UserInputComponent>();
 }
 public void Awake()
 {
     //此处填写Awake逻辑
     m_UserInputComponent = Game.Scene.GetComponent <UserInputComponent>();
 }
 public void Awake()
 {
     this.m_UserInputComponent           = ETModel.Game.Scene.GetComponent <UserInputComponent>();
     this.m_MouseTargetSelectorComponent = ETModel.Game.Scene.GetComponent <MouseTargetSelectorComponent>();
 }