Game Development Reference
In-Depth Information
'Add it to our list of transitions.
MyTransitions.Add(Txn)
End Sub
Public Overrides Sub Entry(ByVal World As Monster)
World.Say("I feel afraid!")
End Sub
Public Overrides Sub ExitFunction(ByVal World As Monster)
End Sub
Public Overrides Sub Update(ByVal World As Monster)
World.BackColor = Color.LightGray
End Sub
End Class
We only need one more state. Add a new class to the project. Name it FeelAngry.vb
and make it inherit from BasicState . Add code until your file looks like the
following:
Public Class FeelAngry
Inherits BasicState
Public Sub New()
Dim Txn As BasicTransition
'Order is important - react to health first.
'I react to health - if low, be afraid.
Txn = New LowHealthTxn()
'Set the next state name of that transition.
Txn.Initialize(GetType(FeelAfraid).Name)
'Add it to our list of transitions.
MyTransitions.Add(Txn)
'If healthy and no intruder, I am happy.
Txn = New NoPlayersTxn()
'Set the next state name of that transition.
Txn.Initialize(GetType(FeelHappy).Name)
'Add it to our list of transitions.
MyTransitions.Add(Txn)
End Sub
Search Nedrilad ::




Custom Search