-
Notifications
You must be signed in to change notification settings - Fork 11
gameObjectScript
mtanksl edited this page Dec 11, 2023
·
3 revisions
Behaviours can be attached during game object creation, using GameObjectScript
.
Let's attach a new Behaviour
to all the monsters.
public class MonsterScript : GameObjectScript<string, Monster>
{
public override string Key
{
get
{
return "";
}
}
public override void Start(Monster monster)
{
if (monster.Metadata.Sentences != null && monster.Metadata.Sentences.Length > 0)
{
Context.Server.GameObjectComponents.AddComponent(monster, new CreatureTalkBehaviour(TalkType.MonsterSay, monster.Metadata.Sentences) );
}
}
public override void Stop(Monster monster)
{
}
}