Esempio n. 1
0
        /// <summary>
        /// Init with index that can be used to replace an old node
        /// </summary>
        public GameObject(SCNNode node, int?index, Dictionary <string, object> gamedefs, bool alive, bool server) : base()
        {
            this.ObjectRootNode = node;
            this.IsAlive        = alive;

            if (index.HasValue)
            {
                this.Index = index.Value;
            }
            else
            {
                this.Index = GameObject.IndexCounter;
                GameObject.IndexCounter += 1;
            }

            this.GeometryNode = node.FindNodeWithGeometry();
            this.PhysicsNode  = node.FindNodeWithPhysicsBody();

            // set the gameObject onto the node
            node.SetGameObject(this);
            this.IsServer = server;

            if (!string.IsNullOrEmpty(node.Name))
            {
                this.InitGameComponents(gamedefs, node.Name);
            }
        }