Update() public méthode

public Update ( ) : void
Résultat void
Exemple #1
0
    public void Update()
    {
//		if (!Active)
//		{
//			return;
//		}

        HandleKeyboard();

        // HACK -- this shouldn't be handled regardless, but has to in order to complete animations
        m_hunter.Update();

        if (m_enabled)
        {
            m_hunter.RunSpeed = hunterSpeed;
            UpdateTreats();

            m_player.Update();
            m_hunter.Update();

            if (DidHunterFindPlayer())
            {
                m_effectSource.clip = m_gotchaEffect;
                m_effectSource.Play();
                Disable();
            }

            DetectCollisions();
        }
        else if (ReadyToExit())
        {
            Cleanup();
            m_parent.MoveToState(StateMachine.State.GameOver);
        }
    }
Exemple #2
0
        static void Main(string[] args)
        {
            EntityManager entityManager = EntityManager.Instance;
            Hunter hunter = new Hunter("John");
            HunterWife hunterWife = new HunterWife("Mia");
            Consumable bottle = new Consumable("Water bottle", "Bottle fileld with water", 5, 3, 1);
            hunter.AddItem(bottle);
            hunter.GetSM().SetCurrentState(EnterHomeAndRest.Instance);
            hunterWife.GetSM().SetGlobalState(WifeGlobalState.Instance);
            entityManager.AddEntity(hunter);
            entityManager.AddEntity(hunterWife);

            for (int i =0; i<45; ++i)
            {

                hunter.Update();
                hunterWife.Update();

                Thread.Sleep(1000);
            }
        }