Example #1
0
    void Start()
    {
        // Initialize the Actor
        base.Start(this.name);
        uiManager = getActorRef(UIManagerPath, system);
        UnityEngine.Debug.Log("PingPong Starting ....");

        // Create the ping and the pong actor
        var ponger = system.ActorOf(PingPongActor.Props(new Messages.Ping(), new Messages.Pong(), UIManagerPath), "ponger");
        var pinger = system.ActorOf(PingPongActor.Props(new Messages.Pong(), new Messages.Ping(), UIManagerPath), "pinger");

        // Create a scheduler to make sure we can send messages to this MonoBehavior
        system.Scheduler.ScheduleTellRepeatedly(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(2), internalActor,
                                                "2 sec Scheduler triggered", internalActor);

        // Start the game ....
        pinger.Tell(new Messages.Pong(), ponger);
    }