Beispiel #1
0
    public static bool Load(UInt32 id, UInt32 characterID, ModelType model_type, string name, Vector3 position)
    {
        if (Instances.Count() >= Max)
        {
            return(false);
        }

        if (Instances.ContainsKey(id))
        {
            return(false);
        }

        GameObject prefab;

        if (ObjectManager.PlayerModels.TryGetValue(model_type, out prefab))
        {
            var character = UnityEngine.Object.Instantiate(ObjectManager.PlayerModels[model_type])
                            .AddComponent <Character>()
                            .Initialize <ClientActor>(characterID, name);
            character.transform.position = position;
            Instances[id] = new Client(id, character);
        }

        return(true);
    }
        public Double ParenthoodScoreAgainst(NodeGraphTemplateCandidate other)
        {
            Int32 instanceParenthoods = 0;

            foreach (NodeGraph instance in Instances)
            {
                String path = instance.path;
                if (other.Instances.Any(x => x.path.StartsWith(path)))
                {
                    instanceParenthoods++;
                }
            }
            Double parentHoodScore = Instances.Count().GetRatio(instanceParenthoods);

            return(parentHoodScore);
        }
Beispiel #3
0
        public NdfObject CreateInstanceOf(NdfClass cls, bool isTopLevelInstance = true)
        {
            var newId = (uint)Instances.Count();

            var inst = new NdfObject {
                Class = cls, Id = newId
            };

            AddEmptyProperties(inst);

            Instances.Add(inst);

            if (isTopLevelInstance)
            {
                TopObjects.Add(inst.Id);
                inst.IsTopObject = true;
            }

            return(inst);
        }