Exemple #1
0
    private void UpdateToolPresentation()
    {
        // Create a temp module
        string     toolPrefabFile = CNetwork.Factory.GetRegisteredPrefabFile(CToolInterface.GetPrefabType(m_CurrentToolType.Get()));
        GameObject toolObject     = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/" + toolPrefabFile));

        // Destroy the old module
        if (m_ParentToolObject.transform.childCount != 0)
        {
            Destroy(m_ParentToolObject.transform.GetChild(0).gameObject);
        }

        // Update the tool info
        UpdateToolInfo(toolObject.GetComponent <CToolInterface>());

        // Destroy the non rendering
        CUtility.DestroyAllNonRenderingComponents(toolObject);

        // Add it to the child object
        toolObject.transform.parent = m_ParentToolObject.transform;

        // Reset some values
        CUtility.SetLayerRecursively(toolObject, LayerMask.NameToLayer("UI 3D"));
        toolObject.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
        toolObject.transform.localRotation = Quaternion.identity;

        // Set the scale a lot smaller
        toolObject.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
    }
Exemple #2
0
    private void SetGalaxyLayer()
    {
        // Resursively set the galaxy layer on the actor
        CUtility.SetLayerRecursively(gameObject, LayerMask.NameToLayer("Galaxy"));

        // Add the galaxy shiftable component
        if (gameObject.GetComponent <GalaxyShiftable>() == null)
        {
            gameObject.AddComponent <GalaxyShiftable>();
        }

        // Set as parent of nothing
        //transform.parent = null;
    }
Exemple #3
0
    private void SetOriginalLayer()
    {
        // Resursively set the original layer on the actor
        CUtility.SetLayerRecursively(gameObject, m_OriginalLayer);

        // Remove the galaxy shiftable component
        if (gameObject.GetComponent <GalaxyShiftable>() != null)
        {
            Destroy(gameObject.GetComponent <GalaxyShiftable>());
        }

        // Set as parent of the ship
        //transform.parent = CGameShips.Ship.transform;
    }
Exemple #4
0
    protected override void _New(CUserSession UserSession)
    {
        _Gob      = mAsset.CreateVisuals((EViewDirection)mRotation);
        _Gob.name = mAsset.mName;
        _Gob.transform.SetParent(UserSession.mPrimaryScene.transform);

        if (mBlueprint)
        {
            CUtility.SetLayerRecursively(_Gob.transform, 9);
            _currentSurfaceColor = Color.white;
        }
        else
        {
            if (mAsset.mItemType == EItemType.DESK)
            {
                _briedcaseGOB = GameObject.CreatePrimitive(PrimitiveType.Cube);
                _briedcaseGOB.GetComponent <MeshRenderer>().material = CGame.PrimaryResources.FlatMat;
                _briedcaseGOB.transform.SetParent(_Gob.transform);
                _briedcaseGOB.transform.localScale    = new Vector3(0.15f, 0.3f, 0.45f);
                _briedcaseGOB.transform.localPosition = new Vector3(0.626f, 0.69f, 1.473f);
                _briedcaseGOB.transform.rotation      = Quaternion.Euler(0.0f, -10.0f, 270.0f);

                _briedcaseGOB.SetActive(false);
            }
            else if (mAsset.mItemType == EItemType.SAFE)
            {
                /*
                 * _textGob = new GameObject("sceneText");
                 * _textGob.transform.SetParent(_Gob.transform);
                 *
                 * _textMesh = _textGob.AddComponent<TextMesh>();
                 * _textMesh.text = mValue.ToString();
                 * _textMesh.characterSize = 0.09f;
                 * _textMesh.fontSize = 32;
                 * _textMesh.color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
                 * _textMesh.anchor = TextAnchor.MiddleCenter;
                 * //text.font = CGame.ToolkitUI.SceneTextFont;
                 *
                 * _textGob.transform.localPosition = new Vector3(0.5f, 0.0f, 0.0f);
                 * _textGob.transform.rotation = Quaternion.Euler(90, 0, 0);
                 */
            }
            else if (mAsset.mItemType == EItemType.START)
            {
                if (mOwnerID == UserSession.mPlayerIndex)
                {
                    _punchOut = CPunchOut.Create(out _punchOutMesh);
                    _punchOut.transform.SetParent(_Gob.transform);
                }
            }
            else if (mAsset.mItemType == EItemType.DOOR)
            {
                _briedcaseGOB = (GameObject)GameObject.Instantiate(CGame.WorldResources.PadlockPrefab, new Vector3(0.5f, 2.25f, 1.0f), Quaternion.identity);
                _briedcaseGOB.transform.SetParent(_Gob.transform);
            }

            _audioSource = _Gob.AddComponent <AudioSource>();
            _audioSource.outputAudioMixerGroup = CGame.UIResources.SoundsMixer;
            _audioSource.spatialBlend          = 1.0f;
        }
    }