// Use this for initialization
    void Start()
    {
        Instance = this;

        _controllers = new List <IController>();

        Contexts    contexts = Contexts.sharedInstance;
        GameContext context  = contexts.game;

        _rootSystem = new RootSystem(contexts);

        _rootSystem.Initialize();

        HexGenerator.Instance = GetComponent <HexGenerator>();

        PlayerHealthModel = new PlayerHealthModel(20);

        PlayerHealthController PlayerHealthController = new PlayerHealthController
        {
            View       = PlayerHealthView,
            Model      = PlayerHealthModel,
            MainMenuUI = MainMenuUI
        };

        PlayerHealthController.Init();

        AboutController About = new AboutController
        {
            View    = AboutView,
            AboutUI = AboutUI
        };

        About.Init();

        MainMenuController MainMenu = new MainMenuController
        {
            View       = MainMenuView,
            MainMenuUI = MainMenuUI,
            AboutUI    = AboutUI
        };

        MainMenu.Init();

        StartModel = new StartModel();

        StartController start = new StartController
        {
            View  = StartView,
            Model = StartModel
        };

        start.Init();

        CreateMoneyController();

        TowerModel model = CreateTowerController();

        CreateTiles(context, model);
    }
Example #2
0
 public void Initialize(RootNode spawningRootNode, RootSystem _rootSystemParent)
 {
     neighborNodes = new RootNode[4] {
         spawningRootNode, null, null, null
     };
     timeOfNextNode   = Time.time + Random.Range(timeToMakeNewNode.x, timeToMakeNewNode.y) * numOfNodes;
     rootSystemParent = _rootSystemParent;
     rootSystemParent.numberOfRoots++;
 }
Example #3
0
 private void OnCollisionEnter(Collision collision)
 {
     if (!isRooted && !collision.transform.CompareTag("Player"))
     {
         Destroy(GetComponent <Rigidbody>()); //To root it in place, we remove it from the dynamic physics system, since it shouldnt move anymore once rooted
         isRooted = true;
         if (rootNodeSystem == null)          //The root system can already exist if we inherited one from an existing egg
         {
             rootNodeSystem = new RootSystem(transform.position);
         }
     }
 }
        public void GetAndRefreshBodyData(RootSystem.Collections.Generic.IList<Windows.Kinect.Body> bodies)
        {
            if (_pNative == RootSystem.IntPtr.Zero) {
                throw new RootSystem.ObjectDisposedException ("BodyFrame");
            }

            int _bodies_idx = 0;
            var _bodies = new RootSystem.IntPtr[bodies.Count];
            for (int i = 0; i < bodies.Count; i++) {
                if (bodies [i] == null) {
                    bodies [i] = new Body ();
                }

                _bodies [_bodies_idx] = bodies [i].GetIntPtr ();
                _bodies_idx++;
            }

            Windows_Kinect_BodyFrame_GetAndRefreshBodyData (_pNative, _bodies, bodies.Count);
            Helper.ExceptionHelper.CheckLastError ();

            for (int i = 0; i < bodies.Count; i++) {
                bodies [i].SetIntPtr (_bodies [i]);
            }
        }
Example #5
0
 private static extern void Windows_Storage_Streams_IBuffer_ReleaseObject(ref RootSystem.IntPtr pNative);
Example #6
0
 private static extern void Windows_Storage_Streams_IBuffer_put_Length(RootSystem.IntPtr pNative, uint value);
Example #7
0
 private static extern uint Windows_Storage_Streams_IBuffer_get_Length(RootSystem.IntPtr pNative);
Example #8
0
 // Constructors and Finalizers
 internal IBuffer(RootSystem.IntPtr pNative)
 {
     _pNative = pNative;
     Windows_Storage_Streams_IBuffer_AddRefObject(ref _pNative);
 }
Example #9
0
 //We can link to an existing root node system, that must mean that we are rooted then
 public void LinkToRootSystem(RootSystem existingRootNodeSys)
 {
     rootNodeSystem = existingRootNodeSys;
     Destroy(GetComponent <Rigidbody>()); //If it exists, destroy it, otherwise itll just destroy null
     isRooted = true;
 }
        public void CollectFaceDataAsync(RootSystem.Action<Microsoft.Kinect.Face.FaceModelData> success, RootSystem.Action<int> failure)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("FaceModelBuilder");
            }

            RootSystem.Guid g = RootSystem.Guid.NewGuid();
            if(success != null)
            {
                Microsoft_Kinect_Face_FaceModelData_Delegate_SuccessCallbacks.Add(g.ToString(), success);
            }
            if(failure != null)
            {
                ErrorCallbacks.Add(g.ToString(), failure);
            }
            Microsoft_Kinect_Face_FaceModelBuilder_CollectFaceDataAsync_Indexed(_pNative, CollectAsyncSuccessDelegate, CollectAsyncFailureDelegate, g.ToString());
            Helper.ExceptionHelper.CheckLastError();
        }
        public static FaceModel Create(float scale, RootSystem.Collections.Generic.Dictionary<Microsoft.Kinect.Face.FaceShapeDeformations, float> faceShapeDeformations)
        {
            int _faceShapeDeformationsKeys_idx=0;
            var _faceShapeDeformationsKeys = new Microsoft.Kinect.Face.FaceShapeDeformations[faceShapeDeformations.Keys.Count];
            foreach(var key in faceShapeDeformations.Keys)
            {
                _faceShapeDeformationsKeys[_faceShapeDeformationsKeys_idx] = (Microsoft.Kinect.Face.FaceShapeDeformations)key;
                _faceShapeDeformationsKeys_idx++;
            }
            int _faceShapeDeformationsValues_idx=0;
            var _faceShapeDeformationsValues = new float[faceShapeDeformations.Values.Count];
            foreach(var value in faceShapeDeformations.Values)
            {
                _faceShapeDeformationsValues[_faceShapeDeformationsValues_idx] = (float)value;
                _faceShapeDeformationsValues_idx++;
            }

            RootSystem.IntPtr objectPointer = Microsoft_Kinect_Face_FaceModel_ctor(scale, _faceShapeDeformationsKeys, _faceShapeDeformationsValues, faceShapeDeformations.Count);
            Helper.ExceptionHelper.CheckLastError();
            if (objectPointer == RootSystem.IntPtr.Zero)
            {
                return null;
            }

            return Helper.NativeObjectCache.CreateOrGetObject<Microsoft.Kinect.Face.FaceModel>(
                objectPointer, n => new Microsoft.Kinect.Face.FaceModel(n));
        }