예제 #1
0
    public UnityShapeSpecification(string name, string url, bool movable, bool recursive, string shader) : base(name, url, movable, recursive, shader)

    {
        //PrintSingleton.Instance.log(" Looking for : " + url);

        entityGO = GameObject.Find(url);

        if (entityGO != null)
        {
            EntityGo ego = (EntityGo)entityGO.GetComponent("EntityGo");
            if (ego == null)
            {
                entityGO.AddComponent <EntityGo>();
                ego = (EntityGo)entityGO.GetComponent("EntityGo");
            }
            //else PrintSingleton.Instance.log(" Already has EntityGO Component");

            Dictionary <string, Agent> agents = VRApplication.Instance.AgentPlateform.Agents;
            string agentName = url + "@localhost:8080";

            if (agents.ContainsKey(agentName))
            {
                Mascaret.Agent agt = agents[agentName];
            }
        }
        //else PrintSingleton.Instance.log("GAME OBJECT NOT FOUND : " + url);

        //GameObject go = GameObject.Find("MascaretApplication");
        //UnityMascaretApplication uma = go.GetComponent<UnityMascaretApplication>();
    }
예제 #2
0
    public override Entity getSelectedEntity()
    {
        if (UnityEngine.Camera.main == null)
        {
            return(null);
        }

        Ray        ray = UnityEngine.Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 200.0f))
        {
            GameObject go  = hit.collider.gameObject;
            EntityGo   ego = go.GetComponent <EntityGo>();
            if (ego != null)
            {
                return(ego.entity);
            }
            else
            {
                PrintSingleton.Instance.log("No selection");
                return(null);
            }
        }
        else
        {
            return(null);
        }
    }
예제 #3
0
    public override void setEntity(Entity entity)
    {
        EntityGo ego = null;

        if (entityGO != null)
        {
            ego = (EntityGo)entityGO.GetComponent("EntityGo");
        }
        if (ego != null)
        {
            ego.entity = entity;
        }
    }
예제 #4
0
    public UnityShapeSpecification(string name, string url, bool movable, bool recursive, string shader) : base(name, url, movable, recursive, shader)

    {
        Debug.Log(" Looking for : " + url);

        entityGO = GameObject.Find(url);

        if (entityGO != null)
        {
            EntityGo ego = (EntityGo)entityGO.GetComponent("EntityGo");
            if (ego == null)
            {
                entityGO.AddComponent <EntityGo>();
                ego = (EntityGo)entityGO.GetComponent("EntityGo");
            }
            else
            {
                Debug.Log(" Already has EntityGO Component");
            }

            Dictionary <string, Agent> agents = VRApplication.Instance.AgentPlateform.Agents;
            string agentName = url + "@localhost:8080";

            if (agents.ContainsKey(agentName))
            {
                Mascaret.Agent agt = agents [agentName];

                UnityBehaviorRealizer bmlRealizer = new UnityBehaviorRealizer(this);
                agt.behaviorRealizer = bmlRealizer;
            }
        }
        else
        {
            Debug.Log("Game object : " + url + " non trouvé");
        }
    }
예제 #5
0
    public override Entity getEntity()
    {
        EntityGo ego = (EntityGo)entityGO.GetComponent("EntityGo");

        return(ego.entity);
    }