Exemple #1
0
 private void CheckTitan()
 {
     if (master != null && master == IN_GAME_MAIN_CAMERA.MainHERO)
     {
         if (Physics.Raycast(baseT.position, velocity, out RaycastHit hit, 10f, Layers.PlayerAttackBox.value))
         {
             Collider hitCollider = hit.collider;
             if (hitCollider.name.Contains("PlayerDetectorRC"))
             {
                 TITAN titan = hitCollider.transform.root.gameObject.GetComponent <TITAN>();
                 if (titan != null)
                 {
                     if (MyTitan == null)
                     {
                         this.MyTitan          = titan;
                         this.MyTitan.IsHooked = true;
                     }
                     else
                     {
                         if (MyTitan != titan)
                         {
                             MyTitan.IsHooked = false;
                             MyTitan          = titan;
                             MyTitan.IsHooked = true;
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #2
0
    public void checkTitan()
    {
        GameObject obj2 = IN_GAME_MAIN_CAMERA.main_object;

        if (((obj2 != null) && (this.master != null)) && (this.master == obj2))
        {
            LayerMask mask = ((int)1) << LayerMask.NameToLayer("PlayerAttackBox");
            if (Physics.Raycast(baseT.position, this.velocity, out RaycastHit hit, 10f, mask.value))
            {
                Collider collider = hit.collider;
                if (collider.name.Contains("PlayerDetectorRC"))
                {
                    TITAN component = collider.transform.root.gameObject.GetComponent <TITAN>();
                    if (component != null)
                    {
                        if (this.myTitan == null)
                        {
                            this.myTitan          = component;
                            this.myTitan.isHooked = true;
                        }
                        else if (this.myTitan != component)
                        {
                            this.myTitan.isHooked = false;
                            this.myTitan          = component;
                            this.myTitan.isHooked = true;
                        }
                    }
                }
            }
        }
    }
Exemple #3
0
    public static TextMesh LabelObjext(TITAN titan)
    {
        if (font == null)
        {
            font = (Font)Resources.FindObjectsOfTypeAll(typeof(Font))[0];
        }
        GameObject obj = new GameObject("info_TITANs");
        float      x   = 1f;

        if (titan.myLevel < 1f)
        {
            x = 1f / titan.myLevel;
        }
        obj.transform.localScale    = new Vector3(x, x, x);
        obj.transform.parent        = titan.gameObject.transform;
        obj.transform.localPosition = Vector3.zero;
        obj.AddComponent <MeshRenderer>().material = font.material;
        TextMesh tm = obj.AddComponent <TextMesh>();

        tm.font     = font;
        tm.fontSize = 0;
        tm.anchor   = TextAnchor.MiddleCenter;
        tm.text     = "size:" + titan.myLevel.ToString("F") + "\n" + "speed:" + titan.speed.ToString("F") + "\n" + titan.abnormalType;
        return(tm);
    }
Exemple #4
0
    public void CheckTitan()
    {
        GameObject main_object = Camera.main.GetComponent <IN_GAME_MAIN_CAMERA>().main_object;

        if (main_object == null || master == null || !(master == main_object) || !Physics.Raycast(layerMask: ((LayerMask)(1 << LayerMask.NameToLayer("PlayerAttackBox"))).value, origin: base.transform.position, direction: velocity, hitInfo: out RaycastHit hitInfo, distance: 10f))
        {
            return;
        }
        Collider collider = hitInfo.collider;

        if (!collider.name.Contains("PlayerDetectorRC"))
        {
            return;
        }
        TITAN component = collider.transform.root.gameObject.GetComponent <TITAN>();

        if (component != null)
        {
            if (myTitan == null)
            {
                myTitan          = component;
                myTitan.isHooked = true;
            }
            else if (myTitan != component)
            {
                myTitan.isHooked = false;
                myTitan          = component;
                myTitan.isHooked = true;
            }
        }
    }
Exemple #5
0
        public override void Execute(InRoomChat irc, string[] args)
        {
            if (args.Length < 1 || !int.TryParse(args[0], out int id))
            {
                return;
            }

            PhotonPlayer player = PhotonPlayer.Find(id);

            if (player == null)
            {
                return;
            }

            if (player.IsTitan)
            {
                TITAN titan = player.GetTitan();
                if (titan == null || titan.hasDie)
                {
                    return;
                }

                titan.photonView.RPC("titanGetHit", player, titan.photonView.viewID, RCSettings.MinimumDamage > 0 ? RCSettings.MinimumDamage : 10);
            }
            else
            {
                HERO hero = player.GetHero();
                if (hero == null || hero.HasDied())
                {
                    return;
                }

                hero.photonView.RPC("netDie", PhotonTargets.All, hero.transform.position, false, -1, "[FF0000]Server", true);
            }
        }
Exemple #6
0
 public override void Execute(InRoomChat irc, string[] args)
 {
     if (args.Length > 0 && int.TryParse(args[0], out int id))
     {
         PhotonPlayer player = PhotonPlayer.Find(id);
         if (player != null)
         {
             if (GameHelper.IsPT(player))
             {
                 TITAN titan = GameHelper.GetPT(player);
                 if (titan != null)
                 {
                     titan.photonView.RPC("titanGetHit", player, titan.photonView.viewID, 10);
                 }
             }
             else
             {
                 HERO hero = GameHelper.GetHero(player);
                 if (hero != null)
                 {
                     hero.photonView.RPC("netDie", PhotonTargets.All, hero.transform.position, false, -1, "[FF0000]Server", true);
                 }
             }
         }
     }
 }
Exemple #7
0
    public void checkTitan()
    {
        GameObject obj2 = Camera.main.GetComponent <IN_GAME_MAIN_CAMERA>().main_object;

        if (obj2 != null && this.master != null && this.master == obj2)
        {
            LayerMask mask = 1 << LayerMask.NameToLayer("PlayerAttackBox");
            if (Physics.Raycast(transform.position, this.velocity, out var hit, 10f, mask.value))
            {
                if (hit.collider.name.Contains("PlayerDetectorRC"))
                {
                    TITAN component = hit.collider.transform.root.gameObject.GetComponent <TITAN>();
                    if (component != null)
                    {
                        if (this.myTitan == null)
                        {
                            this.myTitan          = component;
                            this.myTitan.isHooked = true;
                        }
                        else if (this.myTitan != component)
                        {
                            this.myTitan.isHooked = false;
                            this.myTitan          = component;
                            this.myTitan.isHooked = true;
                        }
                    }
                }
            }
        }
    }
    public void onTitanDown(TITAN t)
    {
        if (this.spawnedTitansHashes.Contains(t.GetHashCode()))
        {
            this.spawnedTitansHashes.Remove(t.GetHashCode());
            this.currentTitans--;

            if (this.mode == SpawnControllerMode.WAVES && !this.customWaves.ContainsKey(this.currentWave))
            {
                if (this.titansToSpawn > 0 && this.canSpawnTitans())
                {
                    this.titansToSpawn -= (this.maxAllowedTitans - this.currentTitans);
                    this.spawnTitans(this.maxAllowedTitans - this.currentTitans);
                }
            }
            else if (this.mode == SpawnControllerMode.FIXED_SPAWN && this.titansToSpawn > 0 && this.canSpawnTitans())
            {
                this.titansToSpawn -= (this.maxAllowedTitans - this.currentTitans);
                this.spawnFixedTitans(this.maxAllowedTitans - this.currentTitans);
            }

            if (this.currentTitans == 0)
            {
                this.handleAllTitansKilled();
            }
        }
    }
Exemple #9
0
        public virtual void OnTitanSpawned(TITAN titan)
        {
            if ((IN_GAME_MAIN_CAMERA.gametype != GAMETYPE.MULTIPLAYER) || titan.photonView.isMine)
            {
                if (!titan.hasSetLevel)
                {
                    titan.myLevel = UnityEngine.Random.Range((float)0.7f, (float)3f);
                    if (TitanCustomSize)
                    {
                        titan.myLevel = UnityEngine.Random.Range(TitanMinimumSize, TitanMaximumSize);
                    }
                    titan.hasSetLevel = true;
                }
            }
            if (titan.maxHealth == 0)
            {
                switch (TitanHealthMode)
                {
                case TitanHealthMode.Fixed:
                    titan.maxHealth = titan.currentHealth = UnityEngine.Random.Range(TitanHealthMinimum, TitanHealthMaximum + 1);
                    break;

                case TitanHealthMode.Scaled:
                    titan.maxHealth = titan.currentHealth = Mathf.Clamp(Mathf.RoundToInt((titan.myLevel / 4f) * UnityEngine.Random.Range(TitanHealthMinimum, TitanHealthMaximum + 1)), TitanHealthMinimum, TitanHealthMaximum);
                    break;
                }
            }
        }
Exemple #10
0
 // HERO.netGrabbed
 public static bool IsGrabValid(int viewID, PhotonMessageInfo info)
 {
     if (IN_GAME_MAIN_CAMERA.Gametype != GameType.Singleplayer)
     {
         if (info != null)
         {
             PhotonView view = PhotonView.Find(viewID);
             if (view != null)
             {
                 GameObject go = PhotonView.Find(viewID).gameObject;
                 if (go != null)
                 {
                     TITAN titan = go.GetComponent <TITAN>();
                     if (titan != null && titan.photonView.ownerId == info.sender.Id)
                     {
                         return(true);
                     }
                     FEMALE_TITAN annie = go.GetComponent <FEMALE_TITAN>();
                     if (annie != null && annie.photonView.ownerId == info.sender.Id)
                     {
                         return(true);
                     }
                 }
             }
         }
         Mod.Logger.Error($"'HERO.netGrabbed' from #{(info == null ? "?" : info.sender.Id.ToString())}");
         if (info.sender != null && !FengGameManagerMKII.IgnoreList.Contains(info.sender.Id))
         {
             FengGameManagerMKII.IgnoreList.Add(info.sender.Id);
         }
         return(false);
     }
     return(true);
 }
Exemple #11
0
        public override void OnTitanKilled(TITAN titan, PhotonPlayer killer, int damage)
        {
            int timeBonus = MathHelper.Floor((damage / 100f) * ScoreMultiplier.Value);

            LifeTimes[killer.Id] += timeBonus;

            FengGameManagerMKII.Instance.photonView.RPC("Chat", killer, ("+" + timeBonus + "second(s)!").AsColor("00FF00"), string.Empty);
        }
Exemple #12
0
    private bool titanCompare(TITAN baseTitan, TITAN compareTitan)
    {
        int operand = this.operand;

        if (operand == 2)
        {
            return(baseTitan == compareTitan);
        }
        return((operand == 5) && (baseTitan != compareTitan));
    }
Exemple #13
0
    private bool titanCompare(TITAN baseTitan, TITAN compareTitan)
    {
        int num = this.operand;

        if (num != 2)
        {
            return(num == 5 && baseTitan != compareTitan);
        }
        return(baseTitan == compareTitan);
    }
Exemple #14
0
    private bool titanCompare(TITAN baseTitan, TITAN compareTitan)
    {
        switch (this.operand)
        {
        case 2:
            return(baseTitan == compareTitan);

        case 5:
            return(baseTitan != compareTitan);
        }
        return(false);
    }
Exemple #15
0
    public void changeTitanAttributes(GameObject titan, AbnormalType type, Vector3 scale)
    {
        Thread.Sleep(100);

        TITAN t = titan.GetComponent <TITAN>();

        lock (t){
            t.nonAI = false;
            t.setAbnormalType(type, type == AbnormalType.TYPE_CRAWLER);
            object[] nslParams = new object[] { scale.x, 0, 0 };
            t.photonView.RPC("netSetLevel", PhotonTargets.AllBuffered, nslParams);
        }
        //titan.transform.localScale = scale;
    }
Exemple #16
0
    private void newTitan()
    {
        TITAN titan = FengGameManagerMKII.instance.spawnTitan(this.normalTitanRate, base.transform.position - ((Vector3)(Vector3.up * (base.transform.position.y - this.getHeight(base.transform.position)))), base.transform.rotation, false);

        if (FengGameManagerMKII.lvlInfo.mapName == "The City I")
        {
            titan.chaseDistance = 120f;
        }
        else
        {
            titan.chaseDistance = 200f;
        }
        titan.PVPfromCheckPt = this;
    }
Exemple #17
0
    private void newTitan()
    {
        TITAN tit = FengGameManagerMKII.FGM.SpawnTitan(this.normalTitanRate, base.transform.position - Vectors.up * (base.transform.position.y - this.getHeight(base.transform.position)), base.transform.rotation, false);

        if (FengGameManagerMKII.Level.MapName == "The City I")
        {
            tit.chaseDistance = 120f;
        }
        else
        {
            tit.chaseDistance = 200f;
        }
        tit.PVPfromCheckPt = this;
    }
Exemple #18
0
    public GameObject spawnTitan(AbnormalType type, float size, Vector3 pos, Quaternion rotation)
    {
        GameObject  titanPrefab = this.instantiateTitan(pos, rotation);
        TITAN_SETUP setup       = titanPrefab.GetComponent <TITAN_SETUP>();
        TITAN       titan       = titanPrefab.GetComponent <TITAN>();

        this.currentTitans++;
        this.spawnedTitansHashes.Add(titan.GetHashCode());

        titan.resetLevel(size);

        ModMain.instance.getTaskManager().addLateUpdateTask(new CallRPCsTaks(titan, size, (int)type));
        return(titanPrefab);
    }
Exemple #19
0
 public override void OnTitanKilled(TITAN titan, PhotonPlayer killer, int damage)
 {
     if (killer == PlayerOne)
     {
         SpawnTitan(1, titan);
     }
     else if (killer == PlayerTwo)
     {
         SpawnTitan(0, titan);
     }
     else
     {
         SpawnTitan(titan.transform.position, titan);
     }
 }
Exemple #20
0
        private TITAN SpawnTitan(Vector3 position, TITAN originalTitan = null)
        {
            GameObject go = FengGameManagerMKII.Instance.SpawnTitanRaw(position, Quaternion.identity);

            if (originalTitan != null)
            {
                TitanClass type = originalTitan.abnormalType;
                go.GetComponent <TITAN>().setAbnormalType2(type, type.Equals(TitanClass.Crawler));
            }
            else
            {
                go.GetComponent <TITAN>().setAbnormalType2(TitanClass.Normal, false);
            }

            return(go.GetComponent <TITAN>());
        }
Exemple #21
0
        // TITAN.setMyTarget
        public static bool IsTargetSetValid(TITAN titan, PhotonMessageInfo info)
        {
            if (IN_GAME_MAIN_CAMERA.Gametype != GameType.Multiplayer ||
                (info != null && titan.photonView.ownerId == info.sender.Id))
            {
                return(true);
            }

            Mod.Logger.Error($"'TITAN.setMyTarget' from #{(info == null ? "?" : info.sender.Id.ToString())}.");
            if (info.sender != null && !FengGameManagerMKII.IgnoreList.Contains(info.sender.Id))
            {
                FengGameManagerMKII.IgnoreList.Add(info.sender.Id);
            }

            return(false);
        }
Exemple #22
0
 // TITAN.playsoundRPC
 public static bool IsSoundPlayValid(TITAN titan, PhotonMessageInfo info)
 {
     if (IN_GAME_MAIN_CAMERA.Gametype != GameType.Singleplayer)
     {
         if (info != null && titan.photonView.ownerId != info.sender.Id)
         {
             Mod.Logger.Error($"'playsoundRPC' from #{(info == null ? "?" : info.sender.Id.ToString())}.");
             if (info.sender != null && !FengGameManagerMKII.IgnoreList.Contains(info.sender.Id))
             {
                 FengGameManagerMKII.IgnoreList.Add(info.sender.Id);
             }
             return(false);
         }
     }
     return(true);
 }
Exemple #23
0
 // TITAN.netSetAbnormalType
 public static bool IsTitanTypeSetValid(TITAN titan, PhotonMessageInfo info)
 {
     if (IN_GAME_MAIN_CAMERA.Gametype != GameType.Singleplayer)
     {
         if (info == null || (titan.photonView.ownerId != info.sender.Id && !info.sender.isMasterClient))
         {
             Mod.Logger.Error($"'netSetAbnormalType' from #{(info == null ? "?" : info.sender.Id.ToString())}.");
             if (info.sender != null && !FengGameManagerMKII.IgnoreList.Contains(info.sender.Id))
             {
                 FengGameManagerMKII.IgnoreList.Add(info.sender.Id);
             }
             return(false);
         }
     }
     return(true);
 }
Exemple #24
0
 // TITAN.grabToLeft
 public static bool IsLeftGrabValid(TITAN titan, PhotonMessageInfo info)
 {
     if (IN_GAME_MAIN_CAMERA.Gametype != GameType.Singleplayer)
     {
         if (info != null && titan.photonView.ownerId != info.sender.Id)
         {
             Mod.Logger.Error($"'grabToLeft' from #{info.sender.Id}.");
             if (info.sender != null && !FengGameManagerMKII.IgnoreList.Contains(info.sender.Id))
             {
                 FengGameManagerMKII.IgnoreList.Add(info.sender.Id);
             }
             return(false);
         }
     }
     return(true);
 }
Exemple #25
0
    private void OnTriggerEnter(Collider other)
    {
        GameObject gameObject = other.transform.gameObject;

        if (gameObject.layer == 8)
        {
            if (playerEventEnter == null)
            {
                return;
            }
            HERO component = gameObject.GetComponent <HERO>();
            if (component != null)
            {
                string key = (string)FengGameManagerMKII.RCVariableNames["OnPlayerEnterRegion[" + myName + "]"];
                if (FengGameManagerMKII.PlayerVariables.ContainsKey(key))
                {
                    FengGameManagerMKII.PlayerVariables[key] = component.photonView.owner;
                }
                else
                {
                    FengGameManagerMKII.PlayerVariables.Add(key, component.photonView.owner);
                }
                playerEventEnter.CheckEvent();
            }
        }
        else
        {
            if (gameObject.layer != 11 || titanEventEnter == null)
            {
                return;
            }
            TITAN component2 = gameObject.transform.root.gameObject.GetComponent <TITAN>();
            if (component2 != null)
            {
                string key = (string)FengGameManagerMKII.RCVariableNames["OnTitanEnterRegion[" + myName + "]"];
                if (FengGameManagerMKII.TitanVariables.ContainsKey(key))
                {
                    FengGameManagerMKII.TitanVariables[key] = component2;
                }
                else
                {
                    FengGameManagerMKII.TitanVariables.Add(key, component2);
                }
                titanEventEnter.CheckEvent();
            }
        }
    }
Exemple #26
0
        // 0 = left, 1 = right
        private TITAN SpawnTitan(byte side, TITAN originalTitan = null)
        {
            // -X = left side of map, +X = right side
            Vector3 position = default;

            switch (side)
            {
            case 0:
                position = new Vector3(MathHelper.RandomInt(LeftMinX.Value, LeftMaxX.Value), GroundLevel.Value, MathHelper.RandomInt(LeftMinZ.Value, LeftMaxZ.Value));
                break;

            case 1:
                position = new Vector3(MathHelper.RandomInt(RightMinX.Value, RightMaxX.Value), GroundLevel.Value, MathHelper.RandomInt(RightMinZ.Value, RightMaxZ.Value));
                break;
            }

            return(SpawnTitan(position, originalTitan));
        }
Exemple #27
0
    private void OnTriggerEnter(Collider other)
    {
        GameObject gameObject = other.transform.gameObject;

        if (gameObject.layer == 8)
        {
            if (this.playerEventEnter != null)
            {
                HERO component = gameObject.GetComponent <HERO>();
                if (component != null)
                {
                    string str = (string)RCManager.RCVariableNames["OnPlayerEnterRegion[" + this.myName + "]"];
                    if (RCManager.playerVariables.ContainsKey(str))
                    {
                        RCManager.playerVariables[str] = component.BasePV.owner;
                    }
                    else
                    {
                        RCManager.playerVariables.Add(str, component.BasePV.owner);
                    }
                    this.playerEventEnter.checkEvent();
                    return;
                }
            }
        }
        else if (gameObject.layer == 11 && this.titanEventEnter != null)
        {
            TITAN titan = gameObject.transform.root.gameObject.GetComponent <TITAN>();
            if (titan != null)
            {
                string str2 = (string)RCManager.RCVariableNames["OnTitanEnterRegion[" + this.myName + "]"];
                if (RCManager.titanVariables.ContainsKey(str2))
                {
                    RCManager.titanVariables[str2] = titan;
                }
                else
                {
                    RCManager.titanVariables.Add(str2, titan);
                }
                this.titanEventEnter.checkEvent();
            }
        }
    }
Exemple #28
0
    private void OnTriggerEnter(Collider other)
    {
        string     str;
        GameObject gameObject = other.transform.gameObject;

        if (gameObject.layer == 8)
        {
            if (this.playerEventEnter != null)
            {
                HERO component = gameObject.GetComponent <HERO>();
                if (component != null)
                {
                    str = (string)FengGameManagerMKII.RCVariableNames["OnPlayerEnterRegion[" + this.myName + "]"];
                    if (FengGameManagerMKII.playerVariables.ContainsKey(str))
                    {
                        FengGameManagerMKII.playerVariables[str] = component.photonView.owner;
                    }
                    else
                    {
                        FengGameManagerMKII.playerVariables.Add(str, component.photonView.owner);
                    }
                    this.playerEventEnter.checkEvent();
                }
            }
        }
        else if ((gameObject.layer == 11) && (this.titanEventEnter != null))
        {
            TITAN titan = gameObject.transform.root.gameObject.GetComponent <TITAN>();
            if (titan != null)
            {
                str = (string)FengGameManagerMKII.RCVariableNames["OnTitanEnterRegion[" + this.myName + "]"];
                if (FengGameManagerMKII.titanVariables.ContainsKey(str))
                {
                    FengGameManagerMKII.titanVariables[str] = titan;
                }
                else
                {
                    FengGameManagerMKII.titanVariables.Add(str, titan);
                }
                this.titanEventEnter.checkEvent();
            }
        }
    }
Exemple #29
0
    private void checkIfBeingCapture()
    {
        playerOn = false;
        titanOn  = false;
        GameObject[] heroes = GameObject.FindGameObjectsWithTag("Player");
        for (int i = 0; i < heroes.Length; i++)
        {
            if (!(Vector3.Distance(heroes[i].transform.position, base.transform.position) < hitTestR))
            {
                continue;
            }
            playerOn = true;
            if (state == CheckPointState.Human && heroes[i].GetPhotonView().isMine)
            {
                if (fengGame.checkpoint != base.gameObject)
                {
                    fengGame.checkpoint = base.gameObject;
                    InRoomChat.Instance.AddLine(("Respawn point changed to Point #" + id).WithColor("A8FF24"));
                }
                break;
            }
        }

        GameObject[] titans = GameObject.FindGameObjectsWithTag("titan");
        for (int i = 0; i < titans.Length; i++)
        {
            TITAN titan = titans[i].GetComponent <TITAN>();
            if (Vector3.Distance(titans[i].transform.position, base.transform.position) < hitTestR + 5f && (!titan || !titan.hasDie))
            {
                titanOn = true;
                if (state == CheckPointState.Titan && titan.photonView.isMine && (bool)titan && titan.nonAI)
                {
                    if (fengGame.checkpoint != base.gameObject)
                    {
                        fengGame.checkpoint = base.gameObject;
                        InRoomChat.Instance.AddLine(("Respawn point changed to Point #" + id).WithColor("A8FF24"));
                    }
                    break;
                }
            }
        }
    }
Exemple #30
0
    public void handleKill(TITAN titan, int playerID, int damage)
    {
        PlayerData data = (PlayerData)this.playerData[playerID];

        data.Kills       += 1;
        data.TotalDamage += damage;
        ModMain.instance.sendToAll("{Debug} Player #" + playerID + " has killed a titan.");

        if (!titan.hasDie)
        {
            lock (titan){
                titan.photonView.RPC("netDie", PhotonTargets.All, new object[0]);
            }

            lock (ModMain.instance.getGameManager()){
                ModMain.instance.getGameManager().photonView.RPC("titanGetKill", PhotonNetwork.player, PhotonPlayer.Find(playerID), damage, titan.name);
            }
        }

        this.spawnTitans(1);
    }