SetScript() public method

public SetScript ( PersonScripts script, object instance ) : void
script PersonScripts
instance object
return void
Exemplo n.º 1
0
        public static void CreatePerson(Entity person)
        {
            if (PeopleTable.ContainsKey(person.Name))
                return;

            SpritesetInstance sprite = AssetManager.GetSpriteset(person.Spriteset);
            Person p = new Person(person.Name, sprite, true);
            p.Layer = person.Layer;
            int w = (int)p.Base["x2"] - (int)p.Base["x1"];
            int h = (int)p.Base["y2"] - (int)p.Base["y1"];
            p.Position = new Vector2f(person.X - w/2, person.Y - h/2);
            for (var i = 0; i < person.Scripts.Count; ++i)
                p.SetScript((PersonScripts)i, person.Scripts[i]);

            PeopleTable.Add(person.Name, p);
            _personlist.Add(person.Name);
            People.Add(p);
        }