Пример #1
0
    private void OnTriggerStay(Collider other)
    {
        if ((IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer && !base.transform.root.gameObject.GetPhotonView().isMine) || !active_me)
        {
            return;
        }

        switch (other.gameObject.tag)
        {
        case "playerHitbox":     // Another player
        {
            if (!FengGameManagerMKII.Level.PVP)
            {
                return;
            }

            HitBox hitbox = other.gameObject.GetComponent <HitBox>();
            if (hitbox == null || hitbox.transform.root == null)
            {
                return;
            }

            HERO hero = hitbox.transform.root.GetComponent <HERO>();
            if (hero != null && hero.myTeam != myTeam && !hero.IsInvincible())
            {
                float damage = 1f - Vector3.Distance(other.gameObject.transform.position, base.transform.position) * 0.05f;
                damage = Mathf.Min(1f, damage);

                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!hero.isGrabbed)
                    {
                        hero.Die((hitbox.transform.root.transform.position - base.transform.position).normalized * damage * 1000f + Vector3.up * 50f, isBite: false);
                    }
                }
                else if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer && !hero.HasDied() && !hero.isGrabbed)
                {
                    hero.MarkDead();
                    hero.photonView.RPC("netDie", PhotonTargets.All, (hitbox.transform.root.position - base.transform.position).normalized * damage * 1000f + Vector3.up * 50f, false, viewID, ownerName, false);
                }
            }
            break;
        }

        case "erenHitbox":     // Eren, idk where his hitbox is LOL
        {
            if (dmg > 0 && !other.gameObject.transform.root.gameObject.GetComponent <TITAN_EREN>().isHit)
            {
                other.gameObject.transform.root.gameObject.GetComponent <TITAN_EREN>().HitByTitan();
            }
            break;
        }

        case "titanneck":     // Normal/Female/Colossal Titan nape
        {
            HitBox hitbox = other.gameObject.GetComponent <HitBox>();
            if (hitbox == null || !CheckIfBehind(hitbox.transform.root.gameObject) || currentHits.Contains(hitbox))
            {
                return;
            }
            hitbox.hitPosition = (base.transform.position + hitbox.transform.position) * 0.5f;
            currentHits.Add(hitbox);

            // Custom hit sound
            hitSound.Play();

            int damage = (int)((currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity - hitbox.transform.root.rigidbody.velocity).magnitude * 10f * scoreMulti);
            damage = Mathf.Max(10, damage);

            // Local minimum damage
            if (damage < Guardian.Mod.Properties.LocalMinDamage.Value)
            {
                GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().ShowDamage(damage);
                return;
            }

            TITAN titan = hitbox.transform.root.GetComponent <TITAN>();
            if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
            {
                if (titan != null && !titan.hasDie)
                {
                    FengGameManagerMKII fgmkii = GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>();
                    fgmkii.netShowDamage(damage);

                    if ((float)damage > titan.myLevel * 100f)
                    {
                        titan.Die();
                        if (PlayerPrefs.GetInt("EnableSS", 0) == 1)
                        {
                            currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, damage, hitbox.transform.root.gameObject, 0.02f);
                        }
                        fgmkii.UpdatePlayerKillInfo(damage);
                    }
                }

                return;
            }

            if (titan != null)
            {
                if (!titan.hasDie)
                {
                    if ((float)damage > titan.myLevel * 100f)
                    {
                        if (PlayerPrefs.GetInt("EnableSS", 0) == 1)
                        {
                            currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, damage, hitbox.transform.root.gameObject, 0.02f);
                        }
                        titan.photonView.RPC("titanGetHit", titan.photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                    }
                }
            }
            else if ((bool)hitbox.transform.root.GetComponent <FEMALE_TITAN>())
            {
                FEMALE_TITAN ft = hitbox.transform.root.GetComponent <FEMALE_TITAN>();
                if (!ft.hasDie)
                {
                    ft.photonView.RPC("titanGetHit", ft.photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                }
            }
            else if ((bool)hitbox.transform.root.GetComponent <COLOSSAL_TITAN>() && !hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().hasDie)
            {
                hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.RPC("titanGetHit", hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage);
            }

            ShowCriticalHitFX(other.gameObject.transform.position);
            break;
        }

        case "titaneye":     // Titan/Female Titan eyes
            if (currentHits.Contains(other.gameObject))
            {
                return;
            }
            currentHits.Add(other.gameObject);
            GameObject gameObject = other.gameObject.transform.root.gameObject;
            if ((bool)gameObject.GetComponent <FEMALE_TITAN>())
            {
                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!gameObject.GetComponent <FEMALE_TITAN>().hasDie)
                    {
                        gameObject.GetComponent <FEMALE_TITAN>().hitEye();
                    }

                    return;
                }

                if (!gameObject.GetComponent <FEMALE_TITAN>().hasDie)
                {
                    gameObject.GetComponent <FEMALE_TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID);
                }
            }
            else if (gameObject.GetComponent <TITAN>().abnormalType != TitanClass.Crawler)
            {
                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!gameObject.GetComponent <TITAN>().hasDie)
                    {
                        gameObject.GetComponent <TITAN>().HitEye();
                    }

                    return;
                }

                if (!gameObject.GetComponent <TITAN>().hasDie)
                {
                    gameObject.GetComponent <TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID);
                }
            }

            ShowCriticalHitFX(other.gameObject.transform.position);
            break;

        case "titanankle":     // Normal/Female Titan ankles
        {
            if (currentHits.Contains(other.gameObject))
            {
                return;
            }
            currentHits.Add(other.gameObject);

            GameObject gameObject2 = other.gameObject.transform.root.gameObject;

            TITAN titan = gameObject2.GetComponent <TITAN>();
            if (titan != null && titan.abnormalType != TitanClass.Crawler)
            {
                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!titan.hasDie)
                    {
                        titan.HitAnkle();
                    }

                    return;
                }

                if (!titan.hasDie)
                {
                    titan.photonView.RPC("hitAnkleRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID);
                }
            }
            else if (gameObject2.GetComponent <FEMALE_TITAN>())
            {
                int damage = (int)((currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity - gameObject2.rigidbody.velocity).magnitude * 10f * scoreMulti);
                damage = Mathf.Max(10, damage);

                // Local minimum damage
                if (damage < Guardian.Mod.Properties.LocalMinDamage.Value)
                {
                    GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().ShowDamage(damage);
                    return;
                }

                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (other.gameObject.name == "ankleR")
                    {
                        if ((bool)gameObject2.GetComponent <FEMALE_TITAN>() && !gameObject2.GetComponent <FEMALE_TITAN>().hasDie)
                        {
                            gameObject2.GetComponent <FEMALE_TITAN>().hitAnkleR(damage);
                        }
                    }
                    else if ((bool)gameObject2.GetComponent <FEMALE_TITAN>() && !gameObject2.GetComponent <FEMALE_TITAN>().hasDie)
                    {
                        gameObject2.GetComponent <FEMALE_TITAN>().hitAnkleL(damage);
                    }

                    return;
                }

                if (other.gameObject.name == "ankleR")
                {
                    if (!gameObject2.GetComponent <FEMALE_TITAN>().hasDie)
                    {
                        gameObject2.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleRRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                    }
                }
                else if (!gameObject2.GetComponent <FEMALE_TITAN>().hasDie)
                {
                    gameObject2.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleLRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                }
            }

            ShowCriticalHitFX(other.gameObject.transform.position);
            break;
        }
        }
    }
Пример #2
0
    private void Update()
    {
        if (!launched)
        {
            return;
        }
        base.transform.Rotate(r);
        v -= 20f * Vector3.up * Time.deltaTime;
        base.transform.position += v * Time.deltaTime;
        if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer && !PhotonNetwork.isMasterClient)
        {
            return;
        }
        LayerMask mask       = 1 << LayerMask.NameToLayer("Ground");
        LayerMask mask2      = 1 << LayerMask.NameToLayer("Players");
        LayerMask mask3      = 1 << LayerMask.NameToLayer("EnemyAABB");
        LayerMask mask4      = (int)mask2 | (int)mask | (int)mask3;
        Vector3   position   = base.transform.position;
        Vector3   lossyScale = base.transform.lossyScale;

        RaycastHit[] array = Physics.SphereCastAll(position, 2.5f * lossyScale.x, base.transform.position - oldP, Vector3.Distance(base.transform.position, oldP), mask4);
        for (int i = 0; i < array.Length; i++)
        {
            RaycastHit raycastHit = array[i];
            switch (LayerMask.LayerToName(raycastHit.collider.gameObject.layer))
            {
            case "EnemyAABB":
                GameObject gameObject = raycastHit.collider.gameObject.transform.root.gameObject;
                TITAN      titan      = gameObject.GetComponent <TITAN>();
                if (titan != null && !titan.hasDie)
                {
                    titan.HitAnkle();
                    if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer)
                    {
                        titan.photonView.RPC("hitAnkleRPC", PhotonTargets.Others, titan.photonView.ownerId);
                    }
                }
                explode();
                break;

            case "Players":
                GameObject gameObject2 = raycastHit.collider.gameObject.transform.root.gameObject;
                TITAN_EREN eren        = gameObject2.GetComponent <TITAN_EREN>();
                if (eren != null)
                {
                    if (!eren.isHit)
                    {
                        eren.HitByTitan();
                    }
                }
                else
                {
                    HERO hero = gameObject2.GetComponent <HERO>();
                    if (hero != null && !hero.HasDied() && !hero.IsInvincible() && !hero.isGrabbed)
                    {
                        if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                        {
                            hero.Die(v.normalized * 1000f + Vector3.up * 50f, isBite: false);
                        }
                        else if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Multiplayer)
                        {
                            hero.MarkDead();
                            int                num            = -1;
                            string             text           = "Rock";
                            EnemyfxIDcontainer efxIDContainer = base.transform.root.gameObject.GetComponent <EnemyfxIDcontainer>();
                            if (efxIDContainer != null)
                            {
                                num  = efxIDContainer.myOwnerViewID;
                                text = efxIDContainer.titanName;
                            }
                            hero.photonView.RPC("netDie", PhotonTargets.All, v.normalized * 1000f + Vector3.up * 50f, false, num, text, true);
                        }
                    }
                }
                break;

            case "Ground":
                explode();
                break;
            }
        }
        oldP = base.transform.position;
    }
Пример #3
0
    private void OnTriggerStay(Collider other)
    {
        if (!active_me)
        {
            return;
        }

        if (!currentHitsII.Contains(other.gameObject))
        {
            currentHitsII.Add(other.gameObject);
            currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartShake(0.1f, 0.1f);

            if (other.gameObject.transform.root.gameObject.tag == "titan")
            {
                currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.GetComponent <HERO>().slashHit.Play();
                GameObject gameObject = (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer) ?
                                        ((GameObject)Object.Instantiate(Resources.Load("hitMeat"))) : PhotonNetwork.Instantiate("hitMeat", base.transform.position, Quaternion.Euler(270f, 0f, 0f), 0);
                gameObject.transform.position = base.transform.position;
                base.transform.root.GetComponent <HERO>().UseBlade();
            }
        }

        switch (other.gameObject.tag)
        {
        case "playerHitbox":     // Another player
        {
            if (!FengGameManagerMKII.Level.PVP)
            {
                return;
            }

            HitBox hitbox = other.gameObject.GetComponent <HitBox>();
            if (hitbox == null || hitbox.transform.root == null)
            {
                return;
            }

            HERO hero = hitbox.transform.root.GetComponent <HERO>();
            if (hero != null && hero.myTeam != myTeam && !hero.IsInvincible())
            {
                float damage = 1f - Vector3.Distance(other.gameObject.transform.position, base.transform.position) * 0.05f;
                damage = Mathf.Min(1f, damage);

                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!hero.isGrabbed)
                    {
                        hero.Die((hitbox.transform.root.transform.position - base.transform.position).normalized * damage * 1000f + Vector3.up * 50f, isBite: false);
                    }

                    return;
                }

                if (!hero.HasDied() && !hero.isGrabbed)
                {
                    if (PlayerPrefs.GetInt("EnableSS", 0) == 1)
                    {
                        currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, 0, hitbox.transform.root.gameObject, 0.02f);
                    }
                    hero.MarkDead();
                    hero.photonView.RPC("netDie", PhotonTargets.All, (hitbox.transform.root.position - base.transform.position).normalized * damage * 1000f + Vector3.up * 50f, false, base.transform.root.gameObject.GetPhotonView().viewID, PhotonView.Find(base.transform.root.gameObject.GetPhotonView().viewID).owner.customProperties[PhotonPlayerProperty.Name], false);
                }
            }
            break;
        }

        case "titanneck":     // Normal/Female/Colossal Titan nape
        {
            HitBox hitbox = other.gameObject.GetComponent <HitBox>();
            if (hitbox == null || !checkIfBehind(hitbox.transform.root.gameObject) || currentHits.Contains(hitbox))
            {
                return;
            }
            hitbox.hitPosition = (base.transform.position + hitbox.transform.position) * 0.5f;
            currentHits.Add(hitbox);
            meatDie.Play();

            int damage = (int)((currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity - hitbox.transform.root.rigidbody.velocity).magnitude * 10f * scoreMulti);
            damage = Mathf.Max(10, damage);

            // Local minimum damage
            if (damage < Guardian.Mod.Properties.LocalMinDamage.Value)
            {
                GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().ShowDamage(damage);
                return;
            }

            TITAN titan = hitbox.transform.root.GetComponent <TITAN>();
            if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
            {
                if (titan != null && !titan.hasDie)
                {
                    if (PlayerPrefs.GetInt("EnableSS", 0) == 1)
                    {
                        currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, damage, hitbox.transform.root.gameObject, 0.02f);
                    }
                    titan.Die();
                    SpawnNapeMeat(currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity, hitbox.transform.root);
                    FengGameManagerMKII fengGame = GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>();
                    fengGame.netShowDamage(damage);
                    fengGame.UpdatePlayerKillInfo(damage);
                }

                return;
            }

            if (titan != null)
            {
                if (!titan.hasDie)
                {
                    if (PlayerPrefs.GetInt("EnableSS", 0) == 1)
                    {
                        currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().StartSnapshot2(hitbox.transform.position, damage, hitbox.transform.root.gameObject, 0.02f);
                    }
                    titan.photonView.RPC("titanGetHit", titan.photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage);

                    if (Guardian.Mod.Properties.MultiplayerNapeMeat.Value)
                    {
                        SpawnNapeMeat(currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity, hitbox.transform.root);
                    }
                }
            }
            else if ((bool)hitbox.transform.root.GetComponent <FEMALE_TITAN>())
            {
                base.transform.root.GetComponent <HERO>().UseBlade(int.MaxValue);

                if (!hitbox.transform.root.GetComponent <FEMALE_TITAN>().hasDie)
                {
                    hitbox.transform.root.GetComponent <FEMALE_TITAN>().photonView.RPC("titanGetHit", hitbox.transform.root.GetComponent <FEMALE_TITAN>().photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                }
            }
            else if ((bool)hitbox.transform.root.GetComponent <COLOSSAL_TITAN>())
            {
                base.transform.root.GetComponent <HERO>().UseBlade(int.MaxValue);

                if (!hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().hasDie)
                {
                    hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.RPC("titanGetHit", hitbox.transform.root.GetComponent <COLOSSAL_TITAN>().photonView.owner, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                }
            }

            ShowCriticalHitFX();
            break;
        }

        case "titaneye":     // Titan/Female Titan eyes
            if (currentHits.Contains(other.gameObject))
            {
                return;
            }
            currentHits.Add(other.gameObject);

            GameObject gameObject2 = other.gameObject.transform.root.gameObject;
            if ((bool)gameObject2.GetComponent <FEMALE_TITAN>())
            {
                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!gameObject2.GetComponent <FEMALE_TITAN>().hasDie)
                    {
                        gameObject2.GetComponent <FEMALE_TITAN>().hitEye();
                    }

                    return;
                }

                if (!gameObject2.GetComponent <FEMALE_TITAN>().hasDie)
                {
                    gameObject2.GetComponent <FEMALE_TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID);
                }
            }
            else if (gameObject2.GetComponent <TITAN>().abnormalType != TitanClass.Crawler)
            {
                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!gameObject2.GetComponent <TITAN>().hasDie)
                    {
                        gameObject2.GetComponent <TITAN>().HitEye();
                    }

                    return;
                }

                if (!gameObject2.GetComponent <TITAN>().hasDie)
                {
                    gameObject2.GetComponent <TITAN>().photonView.RPC("hitEyeRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID);
                }
            }

            ShowCriticalHitFX();
            break;

        case "titanankle":     // Normal/Female Titan ankles
        {
            if (currentHits.Contains(other.gameObject))
            {
                return;
            }
            currentHits.Add(other.gameObject);

            GameObject gameObject3 = other.gameObject.transform.root.gameObject;

            TITAN titan = gameObject3.GetComponent <TITAN>();
            if (titan != null && titan.abnormalType != TitanClass.Crawler)
            {
                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (!titan.hasDie)
                    {
                        titan.HitAnkle();
                    }

                    return;
                }

                if (!titan.hasDie)
                {
                    titan.photonView.RPC("hitAnkleRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID);
                }
            }
            else if (gameObject3.GetComponent <FEMALE_TITAN>())
            {
                int damage = (int)((currentCamera.GetComponent <IN_GAME_MAIN_CAMERA>().main_object.rigidbody.velocity - gameObject3.rigidbody.velocity).magnitude * 10f * scoreMulti);
                damage = Mathf.Max(10, damage);

                // Local minimum damage
                if (damage < Guardian.Mod.Properties.LocalMinDamage.Value)
                {
                    GameObject.Find("MultiplayerManager").GetComponent <FengGameManagerMKII>().ShowDamage(damage);
                    return;
                }

                if (IN_GAME_MAIN_CAMERA.Gametype == GameType.Singleplayer)
                {
                    if (other.gameObject.name == "ankleR")
                    {
                        if ((bool)gameObject3.GetComponent <FEMALE_TITAN>() && !gameObject3.GetComponent <FEMALE_TITAN>().hasDie)
                        {
                            gameObject3.GetComponent <FEMALE_TITAN>().hitAnkleR(damage);
                        }
                    }
                    else if ((bool)gameObject3.GetComponent <FEMALE_TITAN>() && !gameObject3.GetComponent <FEMALE_TITAN>().hasDie)
                    {
                        gameObject3.GetComponent <FEMALE_TITAN>().hitAnkleL(damage);
                    }

                    return;
                }

                if (other.gameObject.name == "ankleR")
                {
                    if (!gameObject3.GetComponent <FEMALE_TITAN>().hasDie)
                    {
                        gameObject3.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleRRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                    }
                }
                else if (!gameObject3.GetComponent <FEMALE_TITAN>().hasDie)
                {
                    gameObject3.GetComponent <FEMALE_TITAN>().photonView.RPC("hitAnkleLRPC", PhotonTargets.MasterClient, base.transform.root.gameObject.GetPhotonView().viewID, damage);
                }
            }

            ShowCriticalHitFX();
            break;
        }
        }
    }