コード例 #1
0
    // Use this for initialization
    void Start()
    {
        //Calculate world co-ordinates
        //8 vertices for outline (determined from collider)
        Bounds  bounds  = GetComponent <Collider>().bounds;
        Vector3 center  = bounds.center;
        float   xExtent = bounds.extents.x;
        float   yExtent = bounds.extents.y;
        float   zExtent = bounds.extents.z;

        WorldVertices[0] = center + new Vector3(-xExtent, -yExtent, -zExtent);
        WorldVertices[1] = center + new Vector3(xExtent, -yExtent, -zExtent);
        WorldVertices[2] = center + new Vector3(xExtent, -yExtent, zExtent);
        WorldVertices[3] = center + new Vector3(-xExtent, -yExtent, zExtent);

        WorldVertices[4] = center + new Vector3(-xExtent, yExtent, -zExtent);
        WorldVertices[5] = center + new Vector3(xExtent, yExtent, -zExtent);
        WorldVertices[6] = center + new Vector3(xExtent, yExtent, zExtent);
        WorldVertices[7] = center + new Vector3(-xExtent, yExtent, zExtent);

        WorldHealthVertices[0]    = new Vector3(WorldVertices[6].x, WorldVertices[6].y, WorldVertices[6].z);
        WorldHealthVertices[0].y -= 0.1f;
        WorldHealthVertices[0].z -= 0.1f;

        WorldHealthVertices[1] = new Vector3(WorldHealthVertices[0].x, WorldHealthVertices[0].y - m_HealthSize, WorldHealthVertices[0].z);
        WorldHealthVertices[2] = new Vector3(WorldHealthVertices[0].x, WorldHealthVertices[0].y - m_HealthSize, WorldHealthVertices[0].z - m_HealthSize);
        WorldHealthVertices[3] = new Vector3(WorldHealthVertices[0].x, WorldHealthVertices[0].y, WorldHealthVertices[0].z - m_HealthSize);

        WorldHealthVertices[4]    = new Vector3(WorldVertices[7].x, WorldVertices[7].y, WorldVertices[7].z);
        WorldHealthVertices[4].y -= 0.1f;
        WorldHealthVertices[4].z -= 0.1f;

        WorldHealthVertices[5] = new Vector3(WorldHealthVertices[4].x, WorldHealthVertices[4].y - m_HealthSize, WorldHealthVertices[0].z);
        WorldHealthVertices[6] = new Vector3(WorldHealthVertices[4].x, WorldHealthVertices[4].y - m_HealthSize, WorldHealthVertices[0].z - m_HealthSize);
        WorldHealthVertices[7] = new Vector3(WorldHealthVertices[4].x, WorldHealthVertices[4].y, WorldHealthVertices[0].z - m_HealthSize);

        //Assign health width
        m_HealthWidth = Mathf.Abs(WorldHealthVertices[0].x - WorldHealthVertices[4].x);

        //Create GLItem
        m_GLItem = new GLItem(ExecuteFunction);

        //Resolve GLManager
        m_GLManager = ManagerResolver.Resolve <IGLManager>();

        //Assign GL material
        m_GLMat = GLMatShader.GetGLMaterial();

        //Assign building
        m_Building = GetComponent <Building>();
    }
コード例 #2
0
ファイル: Selected.cs プロジェクト: StalkerxD/RTS
    // Use this for initialization
    void Start()
    {
        Overlay    = Overlays.CreateTexture();
        IsSelected = false;
        FindMaxWorldSize();

        m_MainMenuWidth = ManagerResolver.Resolve <IGUIManager>().MainMenuWidth;

        m_GLManager = ManagerResolver.Resolve <IGLManager>();
        m_GLMat     = GLMatShader.GetGLMaterial();
        m_GLItem    = new GLItem(GLExecuteFunction);

        //If this unit is land based subscribe to the path changed event
        LandMovement landMovement = GetComponent <LandMovement>();

        if (landMovement != null)
        {
            landMovement.PathChangedEvent += PathChanged;
        }
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        Overlay = Overlays.CreateTexture ();
        IsSelected = false;
        FindMaxWorldSize();

        m_MainMenuWidth = ManagerResolver.Resolve<IGUIManager>().MainMenuWidth;

        m_GLManager = ManagerResolver.Resolve<IGLManager>();
        m_GLMat = GLMatShader.GetGLMaterial ();
        m_GLItem = new GLItem(GLExecuteFunction);

        //If this unit is land based subscribe to the path changed event
        LandMovement landMovement = GetComponent<LandMovement>();
        if (landMovement != null)
        {
            landMovement.PathChangedEvent += PathChanged;
        }
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        //Calculate world co-ordinates
        //8 vertices for outline (determined from collider)
        /*Bounds bounds = GetComponent<BoxCollider>().bounds;
        Vector3 center = bounds.center;
        float xExtent = bounds.extents.x;
        float yExtent = bounds.extents.y;
        float zExtent = bounds.extents.z;

        WorldVertices[0] = center + new Vector3(-xExtent, -yExtent, -zExtent);
        WorldVertices[1] = center + new Vector3(xExtent, -yExtent, -zExtent);
        WorldVertices[2] = center + new Vector3(xExtent, -yExtent, zExtent);
        WorldVertices[3] = center + new Vector3(-xExtent, -yExtent, zExtent);

        WorldVertices[4] = center + new Vector3(-xExtent, yExtent, -zExtent);
        WorldVertices[5] = center + new Vector3(xExtent, yExtent, -zExtent);
        WorldVertices[6] = center + new Vector3(xExtent, yExtent, zExtent);
        WorldVertices[7] = center + new Vector3(-xExtent, yExtent, zExtent);

        WorldHealthVertices[0] = new Vector3(WorldVertices[6].x, WorldVertices[6].y, WorldVertices[6].z);
        WorldHealthVertices[0].y -= 0.1f;
        WorldHealthVertices[0].z -= 0.1f;

        WorldHealthVertices[1] = new Vector3(WorldHealthVertices[0].x, WorldHealthVertices[0].y-m_HealthSize, WorldHealthVertices[0].z);
        WorldHealthVertices[2] = new Vector3(WorldHealthVertices[0].x, WorldHealthVertices[0].y-m_HealthSize, WorldHealthVertices[0].z-m_HealthSize);
        WorldHealthVertices[3] = new Vector3(WorldHealthVertices[0].x, WorldHealthVertices[0].y, WorldHealthVertices[0].z-m_HealthSize);

        WorldHealthVertices[4] = new Vector3(WorldVertices[7].x, WorldVertices[7].y, WorldVertices[7].z);
        WorldHealthVertices[4].y -= 0.1f;
        WorldHealthVertices[4].z -= 0.1f;

        WorldHealthVertices[5] = new Vector3(WorldHealthVertices[4].x, WorldHealthVertices[4].y-m_HealthSize, WorldHealthVertices[0].z);
        WorldHealthVertices[6] = new Vector3(WorldHealthVertices[4].x, WorldHealthVertices[4].y-m_HealthSize, WorldHealthVertices[0].z-m_HealthSize);
        WorldHealthVertices[7] = new Vector3(WorldHealthVertices[4].x, WorldHealthVertices[4].y, WorldHealthVertices[0].z-m_HealthSize);

        //Assign health width
        m_HealthWidth = Mathf.Abs (WorldHealthVertices[0].x - WorldHealthVertices[4].x);*/

        //Create GLItem
        m_GLItem = new GLItem(ExecuteFunction);

        //Resolve GLManager
        m_GLManager = ManagerResolver.Resolve<IGLManager>();

        //Assign GL material
        m_GLMat = GLMatShader.GetGLMaterial();

        //Assign building
        m_Building = GetComponent<Building>();
    }