Esempio n. 1
0
    private void FixedUpdate()
    {
        if ((this.phase == 2 || this.phase == 1) && this.leviMode)
        {
            this.spiralcount++;
            if (this.spiralcount >= 60)
            {
                this.isdestroying = true;
                this.RemoveMe();
                return;
            }
        }
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.Single || BasePV.IsMine)
        {
            if (phase != 0)
            {
                return;
            }
            CheckTitan();
            baseGT.position += (this.velocity * 50f + this.velocity2) * Time.fixedDeltaTime;
            bool flag = false;
            if (Physics.Linecast(nodes.Count > 1 ? nodes[this.nodes.Count - 2] : nodes[this.nodes.Count - 1], baseGT.position, out RaycastHit raycastHit, Layers.EnemyGroundNetwork.value))
            {
                bool      flag3 = true;
                Transform tf    = raycastHit.collider.transform;
                switch (tf.gameObject.layer)
                {
                case Layers.EnemyBoxN:
                    if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                    {
                        BasePV.RPC("tieMeToOBJ", PhotonTargets.Others, new object[] { raycastHit.collider.transform.root.gameObject.GetPhotonView().viewID });
                    }
                    master.LastHook = this;
                    baseT.parent    = tf;
                    break;

                case Layers.GroundN:
                    master.LastHook = null;
                    if (FengGameManagerMKII.Level.Name.StartsWith("Custom-Anarchy"))
                    {
                        if (tf.gameObject.GetComponent <Anarchy.Custom.Scripts.ClippingObjectComponent>() != null)
                        {
                            baseT.parent = tf;
                        }
                        if (tf.gameObject.GetComponent <Anarchy.Custom.Scripts.TrapComponent>() != null)
                        {
                            isOnTrap = true;
                            var trap = tf.gameObject.GetComponent <Anarchy.Custom.Scripts.TrapComponent>();
                            if (trap.Type == Anarchy.Custom.Scripts.TrapType.Both || trap.Type == Anarchy.Custom.Scripts.TrapType.GasUsage)
                            {
                                master.GasMultiplier = trap.GasUsageMultiplier;
                            }
                            if (trap.Type == Anarchy.Custom.Scripts.TrapType.Both || trap.Type == Anarchy.Custom.Scripts.TrapType.Kill)
                            {
                                trapKillTimer = trap.KillTime;
                            }
                        }
                    }
                    break;

                case Layers.NetworkObjectN:
                    if (!tf.gameObject.CompareTag("Player") || leviMode)
                    {
                        break;
                    }

                    if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                    {
                        BasePV.RPC("tieMeToOBJ", PhotonTargets.Others, new object[] { tf.root.gameObject.GetPhotonView().viewID });
                    }
                    master.HookToHuman(tf.root.gameObject, baseT.position);
                    baseT.parent    = tf;
                    master.LastHook = null;
                    break;

                default:
                    flag3 = false;
                    break;
                }
                if (flag3)
                {
                    if (master.State != HeroState.Grab)
                    {
                        master.Launch(raycastHit.point, this.left, this.leviMode);
                    }
                    baseT.position = raycastHit.point;
                    if (this.phase != 2)
                    {
                        this.phase = 1;
                        if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                        {
                            BasePV.RPC("setPhase", PhotonTargets.Others, new object[] { 1 });
                            BasePV.RPC("tieMeTo", PhotonTargets.Others, new object[] { baseT.position });
                        }
                        if (this.leviMode)
                        {
                            this.GetSpiral(master.baseT.position, master.baseT.rotation.eulerAngles);
                        }
                        flag = true;
                    }
                }
            }
            this.nodes.Add(new Vector3(baseGT.position.x, baseGT.position.y, baseGT.position.z));
            if (flag)
            {
                return;
            }

            this.killTime2 += Time.fixedDeltaTime;
            if (this.killTime2 > 0.8f)
            {
                this.phase = 4;
                if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                {
                    BasePV.RPC("setPhase", PhotonTargets.Others, new object[] { 4 });
                }
                return;
            }
            return;
        }
        if (this.phase == 0)
        {
            baseGT.position += (this.velocity * 50f + this.velocity2) * Time.fixedDeltaTime;
            nodes.Add(new Vector3(baseGT.position.x, baseGT.position.y, baseGT.position.z));
        }
    }