static bool Player_SetControls_Prefix(ShipControlls ___m_shipControl)
        {
            AirshipControlls airshipControlls = ___m_shipControl as AirshipControlls;

            if (airshipControlls != null)
            {
                return(true);
            }
            return(true);
        }
Beispiel #2
0
        private void UpdatePrefabs()
        {
            try
            {
                var           stoneGolemTrophyPrefab = PrefabManager.Instance.GetPrefab("TrophySGolem");
                var           surtlingCorePrefab     = PrefabManager.Instance.GetPrefab("SurtlingCore");
                var           raftPrefab             = PrefabManager.Instance.GetPrefab("Raft");
                Ship          raftShip          = raftPrefab.GetComponent <Ship>();
                ShipControlls raftShipControlls = raftPrefab.GetComponentInChildren <ShipControlls>();
                GameObject    onBoardTrigger    = Object.Instantiate(new GameObject(), airshipPiece.PiecePrefab.transform);
                onBoardTrigger.name = "OnBoardTrigger";
                BoxCollider onBoardCollider = onBoardTrigger.AddComponent <BoxCollider>();
                onBoardCollider.isTrigger = true;
                onBoardTrigger.layer      = characterTriggerLayer;
                onBoardTrigger.transform.localPosition = new Vector3(0, 1, 0);
                onBoardTrigger.transform.localScale    = Vector3.one * 2;

                GameObject attachPoint = Object.Instantiate(new GameObject(), airshipPiece.PiecePrefab.transform);
                attachPoint.name = "attachpoint";
                attachPoint.transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
                GameObject shipObject = Object.Instantiate(new GameObject(), airshipPiece.PiecePrefab.transform);
                shipObject.name = "ship";
                GameObject collidersObject = Object.Instantiate(new GameObject(), shipObject.transform);
                collidersObject.name  = "colliders";
                collidersObject.layer = vehicleLayer;
                var colliderObject = airshipPiece.PiecePrefab.transform.Find("collider").gameObject;
                colliderObject.transform.SetParent(collidersObject.transform);
                colliderObject.name  = "Cube";
                colliderObject.layer = vehicleLayer;
                BoxCollider boxCollider = colliderObject.GetComponent <BoxCollider>();
                boxCollider.material = raftPrefab.transform.Find("ship/colliders/Cube").GetComponent <BoxCollider>().material;

                WearNTear wearNTear = airshipPiece.Piece.GetComponent <WearNTear>();
                wearNTear.m_noSupportWear = false;
                wearNTear.m_supports      = true;

                airshipPiece.Piece.m_icon = stoneGolemTrophyPrefab.GetComponent <ItemDrop>().m_itemData.m_shared.m_icons[0];

                airshipPiece.PiecePrefab.AddComponent <AirshipBase>();
                Airship airship = airshipPiece.PiecePrefab.AddComponent <Airship>();
                airship.m_controlGuiPos = raftShip.m_controlGuiPos;
                AddVisualPiece(stoneGolemTrophyPrefab, "crystal1", new Vector3(1f, 0f, -1f), Quaternion.Euler(0f, 0f, 0f), new Vector3(0.5f, 0.5f, 0.5f));
                var surtlingCore = AddVisualPiece(surtlingCorePrefab, "surtlingCore", new Vector3(1f, 1f, 0f), Quaternion.Euler(0f, 0f, 0f), Vector3.one);
                AirshipControlls airshipControlls = surtlingCore.AddComponent <AirshipControlls>();
                airshipControlls.m_attachAnimation = raftShipControlls.m_attachAnimation;
                airshipControlls.m_maxUseRange     = raftShipControlls.m_maxUseRange;

                AddVisualPiece(stoneGolemTrophyPrefab, "crystal2", new Vector3(1f, 0f, 1f), Quaternion.Euler(0f, 180f, 0f), new Vector3(0.5f, 0.5f, 0.5f));
            } finally
            {
                PieceManager.OnPiecesRegistered -= UpdatePrefabs;
            }
        }