示例#1
0
 void Start()
 {
     socketHost = Game.instance.socketHost;
     socket     = socketHost.GetComponent <SocketIOComponent>();
     socket.On("MOVE_BACTERIA", MoveBacteria);
     rb = GetComponent <Rigidbody>();
 }
示例#2
0
    void Awake()
    {
        socketHost        = GetComponent <SocketHost>();
        spawnBacteriaFood = GetComponent <SpawnBacteriaFood>();
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        //Call the InitGame function to initialize the first level
        InitGame();
    }
 void Start()
 {
     socketHost = Game.instance.socketHost;
 }
 void Start()
 {
     antibodyId++;
     socketHost = Game.instance.socketHost;
 }
示例#5
0
 void Start()
 {
     bacteriaFoodId++;
     rb         = GetComponent <Rigidbody>();
     socketHost = Game.instance.socketHost;
 }