• Advertisement

Edgyr45

Member
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

127 Neutral

About Edgyr45

  • Rank
    Newbie
  1. RegisterStaticMethod

    Allright! I'll keep an eye on this feature. Thanks for the answer!
  2. RegisterStaticMethod

    Hi, For the creation of instances, I would like it to look like this : //in angelscript: void Function() { Sprite @mMySprite = Sprite.Create(); }   I would like to stay away from global functions. If I have n object types to create, I would have to have n x global creates to do. And in our case, n might be big (in fact, we cannot know in advance since we parse and generate code from the production's project)   What I was searching for was a way to create a global function, which is a templated function, but mask it under an object type in AngelScript, for exemple :  engine->RegisterGlobalFunction("Sprite@ Sprite.Create()", asFUNCTION(SomeClass, Factory<Sprite>), asCALL_CDECL); Or in english : I know this is a global function but make the user belive it's a static so I can show it in the script IDE's intellisense and in scripts   Thanks!
  3. Object Communication

    I'll run some test with this info.   Thank you very much
  4. Object Communication

    Thanks for the reply!   I cannot predict in advance what functions the "production" programmer will want to use. In your example, you wrote : go2.GetController(). What type does it returns exactly? An asIScriptObject* from a script that implement IController ?   Does that mean, like InvalidPointer suggested, that I can simply cast it?   Zombie @ctrl = cast<Zombie>(go2.GetController());   And let the production programmer call whatever they want in Zombie.as? Or I tell them to use interfaces?   Thank you very much
  5. Object Communication

    Hi, I'm integrating AngelScript into our game engine and I'm facing one problem I would like to ask here. Lets say I have a GameObject class, which can own a asIScriptObject* and call function in it. (Like in the "game" sample). I have two GameObjects, "Go1" with "player.as" and "Go2" with "zombie.as" If a player kills a zombie, a function "void Kill()" must be called from player.as inside the zombie.as script.   I would like to avoid using a Send/Receive message function but to directly call Kill() inside player.as (a lots like in Unity) :    class player { //This is call from the engine on the GameObject's controller script: void DoSomething() { GameObject go2 = Engine.FindObjectByName("Go2"); //What I would like to do, or something like that: Controller go2Controller = go2.GetController("zombie"); go2Controller.kill(); } }     The "void Kill()" function is unknown from the engine, but an "instance" of zombie.as is created in Angelscript's engine. Can I get that instance and call function on it? I'm lost here.   Thank you very much
  • Advertisement