Exemplo n.º 1
0
 private void Update()
 {
     if (this.disable)
     {
         return;
     }
     this.vv += -Vectors.up * this.g * Time.deltaTime;
     base.transform.position += this.vv * Time.deltaTime;
     base.transform.position += this.vh * Time.deltaTime;
     if (Vector3.Distance(this.desPt, base.transform.position) < 20f || base.transform.position.y < 0f)
     {
         base.transform.position = this.desPt;
         if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && PhotonNetwork.IsMasterClient)
         {
             if (FengGameManagerMKII.LAN)
             {
                 Network.Instantiate(CacheResources.Load("FX/boom1_CT_KICK"), base.transform.position + Vectors.up * 30f, Quaternion.Euler(270f, 0f, 0f), 0);
             }
             else
             {
                 Optimization.Caching.Pool.NetworkEnable("FX/boom1_CT_KICK", base.transform.position + Vectors.up * 30f, Quaternion.Euler(270f, 0f, 0f), 0);
             }
         }
         else
         {
             Pool.Enable("FX/boom1_CT_KICK", base.transform.position + Vectors.up * 30f, Quaternion.Euler(270f, 0f, 0f));//UnityEngine.Object.Instantiate(CacheResources.Load("FX/boom1_CT_KICK"), base.transform.position + Vectors.up * 30f, Quaternion.Euler(270f, 0f, 0f));
         }
         this.disable = true;
     }
 }
Exemplo n.º 2
0
 public void CreateGlass()
 {
     this.part_glass = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/glass"));
     this.part_glass.transform.position = this.part_head.transform.position;
     this.part_glass.transform.rotation = this.part_head.transform.rotation;
     this.part_glass.transform.parent   = baseT.Find("Amarture/Controller_Body/hip/spine/chest/neck/head").transform;
 }
Exemplo n.º 3
0
        private void Map_Load(HaloMap map)
        {
            //Load
            cacheResources = new CacheResources(mapFile);

            //Prepare
            checkedTagIds.Clear();
            resourceManager.Clear();
            resourceLookup.Clear();
            tagTreeView.BeginUpdate();
            tagTreeView.Nodes.Clear();
            tagTreeView.PathSeparator = "\\";

            //Loop
            foreach (IndexEntry indexEntry in map.IndexEntries)
            {
                TreeView_CreateTagNode(tagTreeView, $"{indexEntry.Filename}.{ indexEntry.Root.FourCc}", indexEntry.Id);
                ITagGroup tagGroup = TagLookup.CreateTagGroup(indexEntry.Root);
                resourceLookup.Add($"{indexEntry.Filename}.{tagGroup.GroupName}", indexEntry.Id);
            }

            //End
            tagTreeView.TreeViewNodeSorter = new TagNodeSorter();
            tagTreeView.Sort();
            tagTreeView.EndUpdate();

            //Read sound cache file gestalt
            var ugh = mapFile.IndexEntries.Last;

            using (var reader = ugh.Data.GetVirtualStream().CreateReader())
            {
                reader.BaseStream.Seek(mapFile.IndexEntries.Last.Address, SeekOrigin.Begin);
                soundCacheFileGestalt.Read(reader);
            }
        }
Exemplo n.º 4
0
    private static TITAN SpawnTitanRaw(Vector3 position, Quaternion rotation)
    {
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.Single)
        {
            return(((GameObject)Instantiate(CacheResources.Load("TITAN_VER3.1"), position, rotation))
                   .GetComponent <TITAN>());
        }

        return(Pool.NetworkEnable("TITAN_VER3.1", position, rotation).GetComponent <TITAN>());
    }
Exemplo n.º 5
0
    private void OnEnable()
    {
        this.hero = IN_GAME_MAIN_CAMERA.MainObject;
        if (!this.nohint && this.hero != null)
        {
            if (hint == null)
            {
                this.hint = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("UI/" + this.color + "FlareHint"));
            }

            if (this.color == "Black")
            {
                this.offY = Vectors.up * 0.4f;
            }
            else
            {
                this.offY = Vectors.up * 0.5f;
            }
            this.hint.transform.parent   = base.transform.root;
            this.hint.transform.position = this.hero.transform.position + this.offY;
            Vector3 vector = base.transform.position - this.hint.transform.position;
            float   num    = Mathf.Atan2(-vector.z, vector.x) * 57.29578f;
            this.hint.transform.rotation   = Quaternion.Euler(-90f, num + 180f, 0f);
            this.hint.transform.localScale = Vectors.zero;
            iTween.ScaleTo(this.hint, iTween.Hash(new object[]
            {
                "x",
                1f,
                "y",
                1f,
                "z",
                1f,
                "easetype",
                iTween.EaseType.easeOutElastic,
                "time",
                1f
            }));
            iTween.ScaleTo(this.hint, iTween.Hash(new object[]
            {
                "x",
                0,
                "y",
                0,
                "z",
                0,
                "easetype",
                iTween.EaseType.easeInBounce,
                "time",
                0.5f,
                "delay",
                2.5f
            }));
        }
        timer = 0f;
    }
Exemplo n.º 6
0
 public void AddCacheResources(ResourceCache cache)
 {
     if (CacheResources.ContainsKey(cache.Type))
     {
         CacheResources[cache.Type] = CacheResources[cache.Type].updateCount(cache.Count);
     }
     else
     {
         CacheResources[cache.Type] = new ResourceCache(cache.Type, cache.Count);
     }
 }
Exemplo n.º 7
0
 private void WriteCacheResources(HttpResponseBase response)
 {
     if (!CacheResources.Any())
     {
         return;
     }
     response.Output.WriteLine("CACHE:");
     foreach (var cacheResource in CacheResources)
     {
         response.Output.WriteLine(cacheResource);
     }
 }
Exemplo n.º 8
0
 private void setHairPRC(int type, int eye_type, float c1, float c2, float c3)
 {
     UnityEngine.Object.Destroy(this.part_hair);
     this.hair     = CostumeHair.hairsM[type];
     this.hairType = type;
     if (this.hair.hair != string.Empty)
     {
         GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.hair.hair));
         gameObject.transform.parent        = this.hair_go_ref.transform.parent;
         gameObject.transform.position      = this.hair_go_ref.transform.position;
         gameObject.transform.rotation      = this.hair_go_ref.transform.rotation;
         gameObject.transform.localScale    = this.hair_go_ref.transform.localScale;
         gameObject.renderer.material       = CharacterMaterials.Materials[this.hair.texture];
         gameObject.renderer.material.color = new Color(c1, c2, c3);
         this.part_hair = gameObject;
     }
     this.setFacialTexture(this.eye, eye_type);
 }
Exemplo n.º 9
0
    private GameObject GenerateCloth(GameObject go, string res)
    {
        if (!go.GetComponent <SkinnedMeshRenderer>())
        {
            go.AddComponent <SkinnedMeshRenderer>();
        }
        SkinnedMeshRenderer component = go.GetComponent <SkinnedMeshRenderer>();

        Transform[]         bones      = component.bones;
        SkinnedMeshRenderer component2 = ((GameObject)UnityEngine.Object.Instantiate(CacheResources.Load(res))).GetComponent <SkinnedMeshRenderer>();

        component2.gameObject.transform.parent = component.gameObject.transform.parent;
        component2.transform.localPosition     = Vectors.zero;
        component2.transform.localScale        = Vectors.one;
        component2.bones   = bones;
        component2.quality = SkinQuality.Auto;
        return(component2.gameObject);
    }
Exemplo n.º 10
0
    public void CreateHead()
    {
        UnityEngine.Object.Destroy(this.part_eye);
        UnityEngine.Object.Destroy(this.part_face);
        UnityEngine.Object.Destroy(this.part_glass);
        UnityEngine.Object.Destroy(this.part_hair);
        if (!this.IsDeadBody)
        {
            ClothFactory.DisposeObject(this.part_hair_1);
        }
        this.CreateHair();
        if (this.myCostume.eye_mesh.Length > 0)
        {
            this.part_eye = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.eye_mesh));
            this.part_eye.transform.position = this.part_head.transform.position;
            this.part_eye.transform.rotation = this.part_head.transform.rotation;
            this.part_eye.transform.parent   = base.transform.Find("Amarture/Controller_Body/hip/spine/chest/neck/head").transform;
            this.SetFacialTexture(this.part_eye, this.myCostume.eye_texture_id);
        }
        if (this.myCostume.beard_texture_id >= 0)
        {
            this.CreateFace();
            this.SetFacialTexture(this.part_face, this.myCostume.beard_texture_id);
        }
        if (this.myCostume.glass_texture_id >= 0)
        {
            this.CreateGlass();
            this.SetFacialTexture(this.part_glass, this.myCostume.glass_texture_id);
        }
        string indexHead  = myCostume.skin_texture;
        string indexChest = myCostume.skin_texture;

        if (!CharacterMaterials.Materials.ContainsKey(indexHead))
        {
            indexHead = "hair_annie";
        }
        if (!CharacterMaterials.Materials.ContainsKey(indexChest))
        {
            indexChest = "aottg_hero_skin_1";
        }
        this.part_head.renderer.material  = CharacterMaterials.Materials[indexHead];
        this.part_chest.renderer.material = CharacterMaterials.Materials[indexChest];
    }
Exemplo n.º 11
0
 private void ApplyHairSkin(int hair, int eye, string hairlink)
 {
     Destroy(this.part_hair);
     this.hair     = CostumeHair.hairsM[hair];
     this.hairType = hair;
     if (this.hair.hair != string.Empty)
     {
         part_hair = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.hair.hair));
         part_hair.transform.parent     = this.hair_go_ref.transform.parent;
         part_hair.transform.position   = this.hair_go_ref.transform.position;
         part_hair.transform.rotation   = this.hair_go_ref.transform.rotation;
         part_hair.transform.localScale = this.hair_go_ref.transform.localScale;
         part_hair.renderer.material    = CharacterMaterials.Materials[this.hair.texture];
     }
     if (hairSkin != null)
     {
         hairSkin = new Anarchy.Skins.Titans.TitanSkinHair(part_hair, hairlink);
     }
     Anarchy.Skins.Skin.Check(hairSkin, new string[] { hairlink });
     this.setFacialTexture(this.eye, eye);
 }
Exemplo n.º 12
0
    private void updateKillInfo(bool t1, string killer, bool t2, string victim, int dmg, PhotonMessageInfo info)
    {
        if (info != null && !info.Sender.IsMasterClient && dmg != 0 && !t1 && !info.Sender.IsTitan)
        {
            Log.AddLineRaw(
                $"t1:{t1},killer:{killer},t2:{t2},victim:{victim},dmg:{dmg},sender:{info.Sender.ID},isTitan:{info.Sender.IsTitan}",
                MsgType.Warning);
            Log.AddLine("RPCerror", MsgType.Error, info.Sender.ID.ToString(), nameof(updateKillInfo));
            return;
        }

        killer = killer.LimitToLengthStripped(50);
        victim = victim.LimitToLengthStripped(50);
        var killInfo = ((GameObject)Instantiate(CacheResources.Load("UI/KillInfo")))
                       .GetComponent <KillInfoComponent>();

        using (var ien = killInfoList.GetEnumerator())
        {
            while (ien.MoveNext())
            {
                if (ien.Current != null)
                {
                    ien.Current.moveOn();
                }
            }
        }

        if (killInfoList.Count > 4)
        {
            killInfoList.Dequeue().destroy();
        }

        killInfo.SetParent(UIRefer.panels[0].transform);
        killInfo.Show(t1, killer, t2, victim, dmg);
        killInfoList.Enqueue(killInfo);
        if (!info.Sender.IsLocal)
        {
            AnarchyManager.Feed.Kill(killer.ToHTMLFormat(), victim.ToHTMLFormat(), dmg);
        }
    }
Exemplo n.º 13
0
    public void setPunkHair()
    {
        UnityEngine.Object.Destroy(this.part_hair);
        this.hair     = CostumeHair.hairsM[3];
        this.hairType = 3;
        GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.hair.hair));

        gameObject.transform.parent     = this.hair_go_ref.transform.parent;
        gameObject.transform.position   = this.hair_go_ref.transform.position;
        gameObject.transform.rotation   = this.hair_go_ref.transform.rotation;
        gameObject.transform.localScale = this.hair_go_ref.transform.localScale;
        gameObject.renderer.material    = CharacterMaterials.Materials[this.hair.texture];
        int num = UnityEngine.Random.Range(1, 4);

        if (num == 1)
        {
            gameObject.renderer.material.color = FengColor.hairPunk1;
        }
        if (num == 2)
        {
            gameObject.renderer.material.color = FengColor.hairPunk2;
        }
        if (num == 3)
        {
            gameObject.renderer.material.color = FengColor.hairPunk3;
        }
        this.part_hair = gameObject;
        this.setFacialTexture(this.eye, 0);
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && BasePV.IsMine)
        {
            BasePV.RPC("setHairPRC", PhotonTargets.OthersBuffered, new object[]
            {
                this.hairType,
                0,
                this.part_hair.renderer.material.color.r,
                this.part_hair.renderer.material.color.g,
                this.part_hair.renderer.material.color.b
            });
        }
    }
Exemplo n.º 14
0
    private void setHairVanilla()
    {
        UnityEngine.Object.Destroy(this.part_hair);
        int num = UnityEngine.Random.Range(0, CostumeHair.hairsM.Length);

        if (num == 3)
        {
            num = 9;
        }
        this.hairType = num;
        this.hair     = CostumeHair.hairsM[num];
        if (this.hair.hair == string.Empty)
        {
            this.hair     = CostumeHair.hairsM[9];
            this.hairType = 9;
        }
        this.part_hair = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.hair.hair));
        this.part_hair.transform.parent        = this.hair_go_ref.transform.parent;
        this.part_hair.transform.position      = this.hair_go_ref.transform.position;
        this.part_hair.transform.rotation      = this.hair_go_ref.transform.rotation;
        this.part_hair.transform.localScale    = this.hair_go_ref.transform.localScale;
        this.part_hair.renderer.material       = CharacterMaterials.Materials[this.hair.texture];
        this.part_hair.renderer.material.color = HeroCostume.costume[UnityEngine.Random.Range(0, HeroCostume.costume.Length - 5)].hair_color;
        int num2 = UnityEngine.Random.Range(1, 8);

        this.setFacialTexture(this.eye, num2);
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && BasePV.IsMine)
        {
            BasePV.RPC("setHairPRC", PhotonTargets.OthersBuffered, new object[]
            {
                this.hairType,
                num2,
                this.part_hair.renderer.material.color.r,
                this.part_hair.renderer.material.color.g,
                this.part_hair.renderer.material.color.b
            });
        }
    }
Exemplo n.º 15
0
 public void CreateHair()
 {
     UnityEngine.Object.Destroy(this.part_hair);
     if (!this.IsDeadBody)
     {
         ClothFactory.DisposeObject(this.part_hair_1);
     }
     if (this.myCostume.hair_mesh != string.Empty)
     {
         this.part_hair = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.hair_mesh));
         this.part_hair.transform.position      = this.part_head.transform.position;
         this.part_hair.transform.rotation      = this.part_head.transform.rotation;
         this.part_hair.transform.parent        = base.transform.Find("Amarture/Controller_Body/hip/spine/chest/neck/head").transform;
         this.part_hair.renderer.material       = CharacterMaterials.Materials[this.myCostume.hairInfo.texture];
         this.part_hair.renderer.material.color = this.myCostume.hair_color;
     }
     if (this.myCostume.hair_1_mesh.Length > 0 && !this.IsDeadBody)
     {
         string   name     = "Character/" + this.myCostume.hair_1_mesh;
         Material material = CharacterMaterials.Materials[this.myCostume.hairInfo.texture];
         this.part_hair_1 = ClothFactory.GetHair(this.reference, name, material, this.myCostume.hair_color);
     }
 }
Exemplo n.º 16
0
        public override GameAction OnExecute(AgricolaPlayer player, GameActionData data)
        {
            base.OnExecute(player, data);

            var resources = CacheResources.Values.ToList();

            foreach (var cache in TakeResourceCaches)
            {
                resources.Add(cache);
            }

            ActionService.AssignCacheResources(player, eventTriggers, ResultingNotices, resources.ToArray());

            foreach (var cache in resources)
            {
                if (CacheResources.ContainsKey(cache.Type))
                {
                    CacheResources[cache.Type] = new ResourceCache(cache.Type, 0);
                }
            }

            return(this);
        }
Exemplo n.º 17
0
 public void CreateUpperBody()
 {
     UnityEngine.Object.Destroy(this.part_upper_body);
     UnityEngine.Object.Destroy(this.part_brand_1);
     UnityEngine.Object.Destroy(this.part_brand_2);
     UnityEngine.Object.Destroy(this.part_brand_3);
     UnityEngine.Object.Destroy(this.part_brand_4);
     UnityEngine.Object.Destroy(this.part_chest_1);
     UnityEngine.Object.Destroy(this.part_chest_2);
     if (!this.IsDeadBody)
     {
         ClothFactory.DisposeObject(this.part_chest_3);
     }
     this.CreateCape();
     if (this.myCostume.part_chest_object_mesh.Length > 0)
     {
         this.part_chest_1 = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.part_chest_object_mesh));
         this.part_chest_1.transform.position = this.chest_info.transform.position;
         this.part_chest_1.transform.rotation = this.chest_info.transform.rotation;
         this.part_chest_1.transform.parent   = base.transform.Find("Amarture/Controller_Body/hip/spine/chest").transform;
         this.part_chest_1.renderer.material  = CharacterMaterials.Materials[this.myCostume.part_chest_object_texture];
     }
     if (this.myCostume.part_chest_1_object_mesh.Length > 0)
     {
         this.part_chest_2 = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.part_chest_1_object_mesh));
         this.part_chest_2.transform.position = this.chest_info.transform.position;
         this.part_chest_2.transform.rotation = this.chest_info.transform.rotation;
         this.part_chest_2.transform.parent   = base.transform.Find("Amarture/Controller_Body/hip/spine/chest").transform;
         this.part_chest_2.transform.parent   = base.transform.Find("Amarture/Controller_Body/hip/spine/chest").transform;
         this.part_chest_2.renderer.material  = CharacterMaterials.Materials[this.myCostume.part_chest_1_object_texture];
     }
     if (this.myCostume.part_chest_skinned_cloth_mesh.Length > 0 && !this.IsDeadBody)
     {
         this.part_chest_3 = ClothFactory.GetCape(this.reference, "Character/" + this.myCostume.part_chest_skinned_cloth_mesh, CharacterMaterials.Materials[this.myCostume.part_chest_skinned_cloth_texture]);
     }
     if (this.myCostume.body_mesh.Length > 0)
     {
         this.part_upper_body = this.GenerateCloth(this.reference, "Character/" + this.myCostume.body_mesh);
         this.part_upper_body.renderer.material = CharacterMaterials.Materials[this.myCostume.body_texture];
     }
     if (this.myCostume.brand1_mesh.Length > 0)
     {
         this.part_brand_1 = this.GenerateCloth(this.reference, "Character/" + this.myCostume.brand1_mesh);
         this.part_brand_1.renderer.material = CharacterMaterials.Materials[this.myCostume.brand_texture];
     }
     if (this.myCostume.brand2_mesh.Length > 0)
     {
         this.part_brand_2 = this.GenerateCloth(this.reference, "Character/" + this.myCostume.brand2_mesh);
         this.part_brand_2.renderer.material = CharacterMaterials.Materials[this.myCostume.brand_texture];
     }
     if (this.myCostume.brand3_mesh.Length > 0)
     {
         this.part_brand_3 = this.GenerateCloth(this.reference, "Character/" + this.myCostume.brand3_mesh);
         this.part_brand_3.renderer.material = CharacterMaterials.Materials[this.myCostume.brand_texture];
     }
     if (this.myCostume.brand4_mesh.Length > 0)
     {
         this.part_brand_4 = this.GenerateCloth(this.reference, "Character/" + this.myCostume.brand4_mesh);
         this.part_brand_4.renderer.material = CharacterMaterials.Materials[this.myCostume.brand_texture];
     }
     this.part_head.renderer.material  = CharacterMaterials.Materials[this.myCostume.skin_texture];
     this.part_chest.renderer.material = CharacterMaterials.Materials[this.myCostume.skin_texture];
 }
Exemplo n.º 18
0
 private void Start()
 {
     this.rope         = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("rope"));
     this.lineRenderer = this.rope.GetComponent <LineRenderer>();
     FengGameManagerMKII.FGM.AddHook(this);
 }
Exemplo n.º 19
0
 public void Update()
 {
     this.healthTime -= Time.deltaTime;
     UpdateLabel();
     if (this.state == "null")
     {
         return;
     }
     if (this.state == "wait")
     {
         this.waitTime -= Time.deltaTime;
         if (this.waitTime <= 0f)
         {
             baseT.position = new Vector3(30f, 0f, 784f);
             //UnityEngine.Object.Instantiate(CacheResources.Load("FX/ThunderCT"), baseT.position + Vectors.up * 350f, Quaternion.Euler(270f, 0f, 0f));
             Pool.Enable("FX/ThunderCT", baseT.position + Vectors.up * 350f, Quaternion.Euler(270f, 0f, 0f));
             IN_GAME_MAIN_CAMERA.MainCamera.flashBlind();
             if (IN_GAME_MAIN_CAMERA.GameType == GameType.Single)
             {
                 this.idle();
             }
             else if ((!FengGameManagerMKII.LAN) ? BasePV.IsMine : base.networkView.isMine)
             {
                 this.idle();
             }
             else
             {
                 this.state = "null";
             }
         }
     }
     else
     {
         if (this.state == "idle")
         {
             if (this.attackPattern == -1)
             {
                 this.slap("r1");
                 this.attackPattern++;
             }
             else if (this.attackPattern == 0)
             {
                 this.attack_sweep(string.Empty);
                 this.attackPattern++;
             }
             else if (this.attackPattern == 1)
             {
                 this.steam();
                 this.attackPattern++;
             }
             else if (this.attackPattern == 2)
             {
                 this.kick();
                 this.attackPattern++;
             }
             else
             {
                 if (this.isSteamNeed || this.hasDie)
                 {
                     this.steam();
                     this.isSteamNeed = false;
                     return;
                 }
                 if (this.myHero == null)
                 {
                     this.findNearestHero();
                 }
                 else
                 {
                     Vector3 vector  = this.myHero.transform.position - baseT.position;
                     float   current = -Mathf.Atan2(vector.z, vector.x) * 57.29578f;
                     float   f       = -Mathf.DeltaAngle(current, baseGT.rotation.eulerAngles.y - 90f);
                     this.myDistance = Mathf.Sqrt((this.myHero.transform.position.x - baseT.position.x) * (this.myHero.transform.position.x - baseT.position.x) + (this.myHero.transform.position.z - baseT.position.z) * (this.myHero.transform.position.z - baseT.position.z));
                     float num = this.myHero.transform.position.y - baseT.position.y;
                     if (this.myDistance < 85f && UnityEngine.Random.Range(0, 100) < 5)
                     {
                         this.steam();
                         return;
                     }
                     if (num > 310f && num < 350f)
                     {
                         if (Vector3.Distance(this.myHero.transform.position, baseT.Find("APL1").position) < 40f)
                         {
                             this.slap("l1");
                             return;
                         }
                         if (Vector3.Distance(this.myHero.transform.position, baseT.Find("APL2").position) < 40f)
                         {
                             this.slap("l2");
                             return;
                         }
                         if (Vector3.Distance(this.myHero.transform.position, baseT.Find("APR1").position) < 40f)
                         {
                             this.slap("r1");
                             return;
                         }
                         if (Vector3.Distance(this.myHero.transform.position, baseT.Find("APR2").position) < 40f)
                         {
                             this.slap("r2");
                             return;
                         }
                         if (this.myDistance < 150f && Mathf.Abs(f) < 80f)
                         {
                             this.attack_sweep(string.Empty);
                             return;
                         }
                     }
                     if (num < 300f && Mathf.Abs(f) < 80f && this.myDistance < 85f)
                     {
                         this.attack_sweep("_vertical");
                         return;
                     }
                     int num2 = UnityEngine.Random.Range(0, 7);
                     if (num2 == 0)
                     {
                         this.slap("l1");
                     }
                     else if (num2 == 1)
                     {
                         this.slap("l2");
                     }
                     else if (num2 == 2)
                     {
                         this.slap("r1");
                     }
                     else if (num2 == 3)
                     {
                         this.slap("r2");
                     }
                     else if (num2 == 4)
                     {
                         this.attack_sweep(string.Empty);
                     }
                     else if (num2 == 5)
                     {
                         this.attack_sweep("_vertical");
                     }
                     else if (num2 == 6)
                     {
                         this.steam();
                     }
                 }
             }
             return;
         }
         if (this.state == "attack_sweep")
         {
             if (this.attackCheckTimeA != 0f && ((base.animation["attack_" + this.attackAnimation].normalizedTime >= this.attackCheckTimeA && base.animation["attack_" + this.attackAnimation].normalizedTime <= this.attackCheckTimeB) || (!this.attackChkOnce && base.animation["attack_" + this.attackAnimation].normalizedTime >= this.attackCheckTimeA)))
             {
                 if (!this.attackChkOnce)
                 {
                     this.attackChkOnce = true;
                 }
                 foreach (RaycastHit raycastHit in this.checkHitCapsule(this.checkHitCapsuleStart.position, this.checkHitCapsuleEnd.position, this.checkHitCapsuleR))
                 {
                     GameObject gameObject = raycastHit.collider.gameObject;
                     if (gameObject.CompareTag("Player"))
                     {
                         this.killPlayer(gameObject);
                     }
                     if (gameObject.CompareTag("erenHitbox") && this.attackAnimation == "combo_3" && IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer && ((!FengGameManagerMKII.LAN) ? PhotonNetwork.IsMasterClient : Network.isServer))
                     {
                         gameObject.transform.root.gameObject.GetComponent <TITAN_EREN>().hitByFTByServer(3);
                     }
                 }
                 foreach (RaycastHit raycastHit2 in this.checkHitCapsule(this.checkHitCapsuleEndOld, this.checkHitCapsuleEnd.position, this.checkHitCapsuleR))
                 {
                     GameObject gameObject2 = raycastHit2.collider.gameObject;
                     if (gameObject2.CompareTag("Player"))
                     {
                         this.killPlayer(gameObject2);
                     }
                 }
                 this.checkHitCapsuleEndOld = this.checkHitCapsuleEnd.position;
             }
             if (base.animation["attack_" + this.attackAnimation].normalizedTime >= 1f)
             {
                 this.sweepSmokeObject.GetComponent <ParticleSystem>().enableEmission = false;
                 this.sweepSmokeObject.GetComponent <ParticleSystem>().Stop();
                 if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                 {
                     if (!FengGameManagerMKII.LAN)
                     {
                         BasePV.RPC("stopSweepSmoke", PhotonTargets.Others, new object[0]);
                     }
                 }
                 this.findNearestHero();
                 this.idle();
                 this.playAnimation("idle");
             }
         }
         else if (this.state == "kick")
         {
             if (!this.attackChkOnce && base.animation[this.actionName].normalizedTime >= this.attackCheckTime)
             {
                 this.attackChkOnce = true;
                 this.door_broken.SetActive(true);
                 this.door_closed.SetActive(false);
                 if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                 {
                     if (!FengGameManagerMKII.LAN)
                     {
                         BasePV.RPC("changeDoor", PhotonTargets.OthersBuffered, new object[0]);
                     }
                 }
                 if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                 {
                     if (FengGameManagerMKII.LAN)
                     {
                         Network.Instantiate(CacheResources.Load("FX/boom1_CT_KICK"), baseT.position + baseT.Forward() * 120f + baseT.right * 30f, Quaternion.Euler(270f, 0f, 0f), 0);
                         Network.Instantiate(CacheResources.Load("rock"), baseT.position + baseT.Forward() * 120f + baseT.right * 30f, Quaternion.Euler(0f, 0f, 0f), 0);
                     }
                     else
                     {
                         Optimization.Caching.Pool.NetworkEnable("FX/boom1_CT_KICK", baseT.position + baseT.Forward() * 120f + baseT.right * 30f, Quaternion.Euler(270f, 0f, 0f), 0);
                         Optimization.Caching.Pool.NetworkEnable("rock", baseT.position + baseT.Forward() * 120f + baseT.right * 30f, Quaternion.Euler(0f, 0f, 0f), 0);
                     }
                 }
                 else
                 {
                     Pool.Enable("FX/boom1_CT_KICK", baseT.position + baseT.Forward() * 120f + baseT.right * 30f, Quaternion.Euler(270f, 0f, 0f));
                     //UnityEngine.Object.Instantiate(CacheResources.Load("FX/boom1_CT_KICK"), baseT.position + baseT.Forward() * 120f + baseT.right * 30f, Quaternion.Euler(270f, 0f, 0f));
                     Pool.Enable("rock", baseT.position + baseT.Forward() * 120f + baseT.right * 30f, Quaternion.Euler(0f, 0f, 0f));
                 }
             }
             if (base.animation[this.actionName].normalizedTime >= 1f)
             {
                 this.findNearestHero();
                 this.idle();
                 this.playAnimation("idle");
             }
         }
         else if (this.state == "slap")
         {
             if (!this.attackChkOnce && base.animation["attack_slap_" + this.attackAnimation].normalizedTime >= this.attackCheckTime)
             {
                 this.attackChkOnce = true;
                 GameObject gameObject3;
                 if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                 {
                     if (FengGameManagerMKII.LAN)
                     {
                         gameObject3 = (GameObject)Network.Instantiate(CacheResources.Load("FX/boom1"), this.checkHitCapsuleStart.position, Quaternion.Euler(270f, 0f, 0f), 0);
                     }
                     else
                     {
                         gameObject3 = Optimization.Caching.Pool.NetworkEnable("FX/boom1", this.checkHitCapsuleStart.position, Quaternion.Euler(270f, 0f, 0f), 0);
                     }
                     if (gameObject3.GetComponent <EnemyfxIDcontainer>())
                     {
                         gameObject3.GetComponent <EnemyfxIDcontainer>().titanName = base.name;
                     }
                 }
                 else
                 {
                     gameObject3 = Pool.Enable("FX/boom1", this.checkHitCapsuleStart.position, Quaternion.Euler(270f, 0f, 0f));//(GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("FX/boom1"), this.checkHitCapsuleStart.position, Quaternion.Euler(270f, 0f, 0f));
                 }
                 gameObject3.transform.localScale = new Vector3(5f, 5f, 5f);
             }
             if (base.animation["attack_slap_" + this.attackAnimation].normalizedTime >= 1f)
             {
                 this.findNearestHero();
                 this.idle();
                 this.playAnimation("idle");
             }
         }
         else if (this.state == "steam")
         {
             if (!this.attackChkOnce && base.animation[this.actionName].normalizedTime >= this.attackCheckTime)
             {
                 this.attackChkOnce = true;
                 if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                 {
                     if (FengGameManagerMKII.LAN)
                     {
                         Network.Instantiate(CacheResources.Load("FX/colossal_steam"), baseT.position + baseT.Up() * 185f, Quaternion.Euler(270f, 0f, 0f), 0);
                         Network.Instantiate(CacheResources.Load("FX/colossal_steam"), baseT.position + baseT.Up() * 303f, Quaternion.Euler(270f, 0f, 0f), 0);
                         Network.Instantiate(CacheResources.Load("FX/colossal_steam"), baseT.position + baseT.Up() * 50f, Quaternion.Euler(270f, 0f, 0f), 0);
                     }
                     else
                     {
                         Optimization.Caching.Pool.NetworkEnable("FX/colossal_steam", baseT.position + baseT.Up() * 185f, Quaternion.Euler(270f, 0f, 0f), 0);
                         Optimization.Caching.Pool.NetworkEnable("FX/colossal_steam", baseT.position + baseT.Up() * 303f, Quaternion.Euler(270f, 0f, 0f), 0);
                         Optimization.Caching.Pool.NetworkEnable("FX/colossal_steam", baseT.position + baseT.Up() * 50f, Quaternion.Euler(270f, 0f, 0f), 0);
                     }
                 }
                 else
                 {
                     Pool.Enable("FX/colossal_steam", baseT.position + baseT.Forward() * 185f, Quaternion.Euler(270f, 0f, 0f));
                     Pool.Enable("FX/colossal_steam", baseT.position + baseT.Forward() * 303f, Quaternion.Euler(270f, 0f, 0f));
                     Pool.Enable("FX/colossal_steam", baseT.position + baseT.Forward() * 50f, Quaternion.Euler(270f, 0f, 0f));
                     //UnityEngine.Object.Instantiate(CacheResources.Load("FX/colossal_steam"), baseT.position + baseT.Forward() * 185f, Quaternion.Euler(270f, 0f, 0f));
                     //UnityEngine.Object.Instantiate(CacheResources.Load("FX/colossal_steam"), baseT.position + baseT.Forward() * 303f, Quaternion.Euler(270f, 0f, 0f));
                     //UnityEngine.Object.Instantiate(CacheResources.Load("FX/colossal_steam"), baseT.position + baseT.Forward() * 50f, Quaternion.Euler(270f, 0f, 0f));
                 }
             }
             if (base.animation[this.actionName].normalizedTime >= 1f)
             {
                 if (IN_GAME_MAIN_CAMERA.GameType == GameType.MultiPlayer)
                 {
                     if (FengGameManagerMKII.LAN)
                     {
                         Network.Instantiate(CacheResources.Load("FX/colossal_steam_dmg"), baseT.position + baseT.Up() * 185f, Quaternion.Euler(270f, 0f, 0f), 0);
                         Network.Instantiate(CacheResources.Load("FX/colossal_steam_dmg"), baseT.position + baseT.Up() * 303f, Quaternion.Euler(270f, 0f, 0f), 0);
                         Network.Instantiate(CacheResources.Load("FX/colossal_steam_dmg"), baseT.position + baseT.Up() * 50f, Quaternion.Euler(270f, 0f, 0f), 0);
                     }
                     else
                     {
                         GameObject gameObject4 = Optimization.Caching.Pool.NetworkEnable("FX/colossal_steam_dmg", baseT.position + baseT.Up() * 185f, Quaternion.Euler(270f, 0f, 0f), 0);
                         if (gameObject4.GetComponent <EnemyfxIDcontainer>())
                         {
                             gameObject4.GetComponent <EnemyfxIDcontainer>().titanName = base.name;
                         }
                         gameObject4 = Optimization.Caching.Pool.NetworkEnable("FX/colossal_steam_dmg", baseT.position + baseT.Up() * 303f, Quaternion.Euler(270f, 0f, 0f), 0);
                         if (gameObject4.GetComponent <EnemyfxIDcontainer>())
                         {
                             gameObject4.GetComponent <EnemyfxIDcontainer>().titanName = base.name;
                         }
                         gameObject4 = Optimization.Caching.Pool.NetworkEnable("FX/colossal_steam_dmg", baseT.position + baseT.Up() * 50f, Quaternion.Euler(270f, 0f, 0f), 0);
                         if (gameObject4.GetComponent <EnemyfxIDcontainer>())
                         {
                             gameObject4.GetComponent <EnemyfxIDcontainer>().titanName = base.name;
                         }
                     }
                 }
                 else
                 {
                     Pool.Enable("FX/colossal_steam_dmg", baseT.position + baseT.Forward() * 185f, Quaternion.Euler(270f, 0f, 0f));
                     Pool.Enable("FX/colossal_steam_dmg", baseT.position + baseT.Forward() * 303f, Quaternion.Euler(270f, 0f, 0f));
                     Pool.Enable("FX/colossal_steam_dmg", baseT.position + baseT.Forward() * 50f, Quaternion.Euler(270f, 0f, 0f));
                     //UnityEngine.Object.Instantiate(CacheResources.Load("FX/colossal_steam_dmg"), baseT.position + baseT.Forward() * 185f, Quaternion.Euler(270f, 0f, 0f));
                     //UnityEngine.Object.Instantiate(CacheResources.Load("FX/colossal_steam_dmg"), baseT.position + baseT.Forward() * 303f, Quaternion.Euler(270f, 0f, 0f));
                     //UnityEngine.Object.Instantiate(CacheResources.Load("FX/colossal_steam_dmg"), baseT.position + baseT.Forward() * 50f, Quaternion.Euler(270f, 0f, 0f));
                 }
                 if (this.hasDie)
                 {
                     if (IN_GAME_MAIN_CAMERA.GameType == GameType.Single)
                     {
                         UnityEngine.Object.Destroy(baseG);
                     }
                     else if (FengGameManagerMKII.LAN)
                     {
                         if (base.networkView.isMine)
                         {
                         }
                     }
                     else if (PhotonNetwork.IsMasterClient)
                     {
                         PhotonNetwork.Destroy(BasePV);
                     }
                     FengGameManagerMKII.FGM.GameWin();
                 }
                 this.findNearestHero();
                 this.idle();
                 this.playAnimation("idle");
             }
         }
         else if (this.state == string.Empty)
         {
         }
     }
 }
Exemplo n.º 20
0
        public void TakeCaches(AgricolaPlayer player, Dictionary <Resource, int> leaveBehind, Dictionary <Resource, int> gained)
        {
            var taking = new Dictionary <Resource, int>();

            foreach (var cache in CacheResources)
            {
                if (!taking.ContainsKey(cache.Value.Type))
                {
                    taking[cache.Value.Type] = cache.Value.Count;
                }
                else
                {
                    taking[cache.Value.Type] += cache.Value.Count;
                }
            }

            if (leaveBehind != null)
            {
                foreach (var cache in leaveBehind)
                {
                    if (taking.ContainsKey(cache.Key))
                    {
                        taking[cache.Key] -= leaveBehind[cache.Key];
                    }
                }
            }

            var takingCaches = taking.Select(x => new ResourceCache(x.Key, x.Value));

            if (eventTriggers != null)
            {
                foreach (var trigger in eventTriggers)
                {
                    if (trigger.GetType() == typeof(TravelingPlayersActionTrigger))
                    {
                        ((TravelingPlayersActionTrigger)trigger).FoodTaken = taking[Resource.Food];
                    }
                }
            }

            if (gained != null)
            {
                foreach (var kvp in gained)
                {
                    if (!taking.ContainsKey(kvp.Key))
                    {
                        taking[kvp.Key] = kvp.Value;
                    }
                    else
                    {
                        taking[kvp.Key] += kvp.Value;
                    }
                }
            }


            if (takingCaches.Count() > 1)
            {
                ActionService.AssignCacheResources(player,
                                                   eventTriggers,
                                                   ResultingNotices,
                                                   taking.Select(x => new ResourceCache(x.Key, x.Value)).ToArray());

                foreach (var kvp in taking)
                {
                    if (CacheResources.ContainsKey(kvp.Key))
                    {
                        var cache = CacheResources[kvp.Key];
                        CacheResources[kvp.Key] = cache.updateCount(-kvp.Value);
                    }
                }
            }
            else
            {
                var cache = CacheResources.Values.First();
                if (cache.Type.IsAnimal())
                {
                    //player.Game.AddInterrupt(new AssignAnimalsAction(player, cache, ResultingNotices));
                }
                else
                {
                    ActionService.AssignCacheResource(player, eventTriggers, ResultingNotices, new ResourceCache(cache.Type, taking[cache.Type]));
                }
                CacheResources[cache.Type] = cache.updateCount(-taking[cache.Type]);
            }
        }
Exemplo n.º 21
0
    public void labelRPC(int health, int healthMax)
    {
        if (health < 0)
        {
            if (healthLabel != null)
            {
                Destroy(healthLabel);
            }
        }
        else
        {
            if (healthLabel == null)
            {
                healthLabel                         = (GameObject)Instantiate(CacheResources.Load("UI/LabelNameOverHead"));
                healthLabel.name                    = "LabelNameOverHead";
                healthLabel.transform.parent        = baseT;
                healthLabel.transform.localPosition = new Vector3(0f, 20f + 1f / myLevel, 0f);
                var num = 1f;
                if (myLevel < 1f)
                {
                    num = 1f / myLevel;
                }

                healthLabel.transform.localScale          = new Vector3(num, num, num);
                healthLabel.GetComponent <UILabel>().text = string.Empty;
                var txt = healthLabel.GetComponent <TextMesh>();
                if (txt == null)
                {
                    txt = healthLabel.AddComponent <TextMesh>();
                }

                var render = healthLabel.GetComponent <MeshRenderer>();
                if (render == null)
                {
                    render = healthLabel.AddComponent <MeshRenderer>();
                }

                render.material      = Labels.Font.material;
                txt.font             = Labels.Font;
                txt.fontSize         = 20;
                txt.anchor           = TextAnchor.MiddleCenter;
                txt.alignment        = TextAlignment.Center;
                txt.color            = Colors.white;
                txt.text             = healthLabel.GetComponent <UILabel>().text;
                txt.richText         = true;
                txt.gameObject.layer = 5;
                if (abnormalType == AbnormalType.Crawler)
                {
                    healthLabel.transform.localPosition = new Vector3(0f, 10f + 1f / myLevel, 0f);
                }

                healthLabelEnabled = true;
            }

            var str  = "[7FFF00]";
            var num2 = health / (float)healthMax;
            if (num2 < 0.75f && num2 >= 0.5f)
            {
                str = "[f2b50f]";
            }
            else if (num2 < 0.5f && num2 >= 0.25f)
            {
                str = "[ff8100]";
            }
            else if (num2 < 0.25f)
            {
                str = "[ff3333]";
            }

            healthLabel.GetComponent <TextMesh>().text = (str + Convert.ToString(health)).ToHTMLFormat();
        }
    }
Exemplo n.º 22
0
 public void labelRPC(int health, int maxHealth)
 {
     if (health < 0)
     {
         if (healthLabel != null)
         {
             Destroy(this.healthLabel);
         }
     }
     else
     {
         if (healthLabel == null)
         {
             healthLabel                         = (GameObject)Instantiate(CacheResources.Load("UI/LabelNameOverHead"));
             healthLabel.name                    = "LabelNameOverHead";
             healthLabel.transform.parent        = transform;
             healthLabel.transform.localPosition = new Vector3(0f, 430f, 0f);
             float num = 15f;
             if (this.size > 0f && this.size < 1f)
             {
                 num = 15f / this.size;
                 num = Mathf.Min(num, 100f);
             }
             this.healthLabel.transform.localScale     = new Vector3(num, num, num);
             healthLabel.GetComponent <UILabel>().text = string.Empty;
             TextMesh txt = healthLabel.GetComponent <TextMesh>();
             if (txt == null)
             {
                 txt = healthLabel.AddComponent <TextMesh>();
             }
             MeshRenderer render = healthLabel.GetComponent <MeshRenderer>();
             if (render == null)
             {
                 render = healthLabel.AddComponent <MeshRenderer>();
             }
             render.material      = Optimization.Labels.Font.material;
             txt.font             = Optimization.Labels.Font;
             txt.fontSize         = 20;
             txt.anchor           = TextAnchor.MiddleCenter;
             txt.alignment        = TextAlignment.Center;
             txt.color            = Colors.white;
             txt.text             = healthLabel.GetComponent <UILabel>().text;
             txt.richText         = true;
             txt.gameObject.layer = 5;
         }
         string str  = "[7FFF00]";
         float  num2 = (float)health / (float)maxHealth;
         if (num2 < 0.75f && num2 >= 0.5f)
         {
             str = "[f2b50f]";
         }
         else if (num2 < 0.5f && num2 >= 0.25f)
         {
             str = "[ff8100]";
         }
         else if (num2 < 0.25f)
         {
             str = "[ff3333]";
         }
         this.healthLabel.GetComponent <TextMesh>().text = (str + System.Convert.ToString(health)).ToHTMLFormat();
     }
 }
Exemplo n.º 23
0
    private void OnLevelWasLoaded(int level)
    {
        if (level == 0)
        {
            return;
        }

        if (Application.loadedLevelName == "characterCreation" || Application.loadedLevelName == "SnapShot")
        {
            return;
        }

        var array = GameObject.FindGameObjectsWithTag("titan");

        foreach (var go in array)
        {
            if (go.GetPhotonView() == null || !go.GetPhotonView().owner.IsMasterClient)
            {
                Destroy(go);
            }
        }

        gameStart = true;
        Pool.Clear();
        RespawnPositions.Dispose();
        ShowHUDInfoCenter(string.Empty);
        var gameObject2 = (GameObject)Instantiate(CacheResources.Load("MainCamera_mono"),
                                                  CacheGameObject.Find("cameraDefaultPosition").transform.position,
                                                  CacheGameObject.Find("cameraDefaultPosition").transform.rotation);

        Destroy(CacheGameObject.Find("cameraDefaultPosition"));
        gameObject2.name  = "MainCamera";
        Screen.lockCursor = true;
        Screen.showCursor = true;
        var ui = (GameObject)Instantiate(CacheResources.Load("UI_IN_GAME"));

        ui.name = "UI_IN_GAME";
        ui.SetActive(true);
        UIRefer = ui.GetComponent <UIReferArray>();
        NGUITools.SetActive(UIRefer.panels[0], true);
        NGUITools.SetActive(UIRefer.panels[1], false);
        NGUITools.SetActive(UIRefer.panels[2], false);
        NGUITools.SetActive(UIRefer.panels[3], false);
        IN_GAME_MAIN_CAMERA.MainCamera.setHUDposition();
        IN_GAME_MAIN_CAMERA.MainCamera.setDayLight(IN_GAME_MAIN_CAMERA.DayLight);
        var info = Level;

        ClothFactory.ClearClothCache();
        logic.OnGameRestart();
        PlayerList = new PlayerList();
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.Single)
        {
            LoadSkinCheck();
            CustomLevel.OnLoadLevel();
            singleKills = 0;
            singleMax   = 0;
            singleTotal = 0;
            IN_GAME_MAIN_CAMERA.MainCamera.enabled = true;
            IN_GAME_MAIN_CAMERA.SpecMov.disable    = true;
            IN_GAME_MAIN_CAMERA.Look.disable       = true;
            IN_GAME_MAIN_CAMERA.GameMode           = Level.Mode;
            SpawnPlayer(IN_GAME_MAIN_CAMERA.singleCharacter.ToUpper());
            Screen.lockCursor = IN_GAME_MAIN_CAMERA.CameraMode >= CameraType.TPS;
            Screen.showCursor = false;
            var rate = 90;
            if (difficulty == 1)
            {
                rate = 70;
            }

            SpawnTitansCustom(rate, info.EnemyNumber);
            return;
        }

        PVPcheckPoint.chkPts = new ArrayList();
        IN_GAME_MAIN_CAMERA.MainCamera.enabled = false;
        IN_GAME_MAIN_CAMERA.BaseCamera.GetComponent <CameraShake>().enabled = false;
        IN_GAME_MAIN_CAMERA.GameType = GameType.MultiPlayer;
        LoadSkinCheck();
        CustomLevel.OnLoadLevel();
        switch (info.Mode)
        {
        case GameMode.Trost:
        {
            CacheGameObject.Find("playerRespawn").SetActive(false);
            Destroy(CacheGameObject.Find("playerRespawn"));
            var gameObject3 = CacheGameObject.Find("rock");
            gameObject3.animation["lift"].speed = 0f;
            CacheGameObject.Find("door_fine").SetActive(false);
            CacheGameObject.Find("door_broke").SetActive(true);
            Destroy(CacheGameObject.Find("ppl"));
            break;
        }

        case GameMode.BossFightCT:
            CacheGameObject.Find("playerRespawnTrost").SetActive(false);
            Destroy(CacheGameObject.Find("playerRespawnTrost"));
            break;
        }

        if (needChooseSide)
        {
            ShowHUDInfoTopCenterADD("\n\nPRESS 1 TO ENTER GAME");
        }
        else
        {
            Screen.lockCursor = IN_GAME_MAIN_CAMERA.CameraMode >= CameraType.TPS;
            if (IN_GAME_MAIN_CAMERA.GameMode == GameMode.PVP_CAPTURE)
            {
                if ((int)PhotonNetwork.player.Properties[PhotonPlayerProperty.isTitan] == 2)
                {
                    checkpoint = CacheGameObject.Find("PVPchkPtT");
                }
                else
                {
                    checkpoint = CacheGameObject.Find("PVPchkPtH");
                }
            }

            if ((int)PhotonNetwork.player.Properties[PhotonPlayerProperty.isTitan] == 2)
            {
                SpawnNonAiTitan(myLastHero);
            }
            else
            {
                SpawnPlayer(myLastHero);
            }
        }

        if (info.Mode == GameMode.BossFightCT)
        {
            Destroy(CacheGameObject.Find("rock"));
        }

        if (PhotonNetwork.IsMasterClient)
        {
            switch (info.Mode)
            {
            case GameMode.Trost:
            {
                if (!IsPlayerAllDead())
                {
                    var gameObject4 = Pool.NetworkEnable("TITAN_EREN_trost", new Vector3(-200f, 0f, -194f),
                                                         Quaternion.Euler(0f, 180f, 0f));
                    gameObject4.GetComponent <TITAN_EREN>().rockLift = true;
                    var rate2 = 90;
                    if (difficulty == 1)
                    {
                        rate2 = 70;
                    }

                    var array3      = GameObject.FindGameObjectsWithTag("titanRespawn");
                    var gameObject5 = CacheGameObject.Find("titanRespawnTrost");
                    if (gameObject5 != null)
                    {
                        foreach (var gameObject6 in array3)
                        {
                            if (gameObject6.transform.parent.gameObject == gameObject5)
                            {
                                SpawnTitan(rate2, gameObject6.transform.position, gameObject6.transform.rotation);
                            }
                        }
                    }
                }

                break;
            }

            case GameMode.BossFightCT:
            {
                if (!IsPlayerAllDead())
                {
                    Pool.NetworkEnable("COLOSSAL_TITAN", -Vectors.up * 10000f, Quaternion.Euler(0f, 180f, 0f));
                }

                break;
            }

            case GameMode.KillTitan:
            case GameMode.EndlessTitan:
            case GameMode.SurviveMode:
            {
                if (info.Name == "Annie" || info.Name == "Annie II")
                {
                    Pool.NetworkEnable("FEMALE_TITAN", CacheGameObject.Find("titanRespawn").transform.position,
                                       CacheGameObject.Find("titanRespawn").transform.rotation);
                }
                else
                {
                    var rate3 = 90;
                    if (difficulty == 1)
                    {
                        rate3 = 70;
                    }

                    SpawnTitansCustom(rate3, info.EnemyNumber);
                }

                break;
            }

            default:
            {
                if (info.Mode != GameMode.Trost)
                {
                    if (info.Mode == GameMode.PVP_CAPTURE && Level.MapName == "OutSide")
                    {
                        var array5 = GameObject.FindGameObjectsWithTag("titanRespawn");
                        if (array5.Length <= 0)
                        {
                            return;
                        }

                        for (var k = 0; k < array5.Length; k++)
                        {
                            SpawnTitanRaw(array5[k].transform.position, array5[k].transform.rotation)
                            .SetAbnormalType(AbnormalType.Crawler, true);
                        }
                    }
                }

                break;
            }
            }
        }

        if (!info.Supply)
        {
            Destroy(CacheGameObject.Find("aot_supply"));
        }

        if (!PhotonNetwork.IsMasterClient)
        {
            BasePV.RPC("RequireStatus", PhotonTargets.MasterClient);
        }

        if (Stylish != null)
        {
            Stylish.enabled = true;
        }

        if (Level.LavaMode)
        {
            Instantiate(CacheResources.Load("levelBottom"), new Vector3(0f, -29.5f, 0f), Quaternion.Euler(0f, 0f, 0f));
            CacheGameObject.Find("aot_supply").transform.position =
                CacheGameObject.Find("aot_supply_lava_position").transform.position;
            CacheGameObject.Find("aot_supply").transform.rotation =
                CacheGameObject.Find("aot_supply_lava_position").transform.rotation;
        }

        if (GameModes.BombMode.Enabled)
        {
            if (Level.Name.StartsWith("The Forest"))
            {
                // Added the creation of an empty gameobject with MapCeilingObject as a component - Thyme 02/28/21
                GameObject mapCeiling = new GameObject("MapCeilingPrefab");
                mapCeiling.AddComponent <TLW.MapCeiling>();
                mapCeiling.transform.position   = new Vector3(0f, 280f, 0f);
                mapCeiling.transform.rotation   = Quaternion.identity;
                mapCeiling.transform.localScale = new Vector3(1320f, 20f, 1320f);
            }
            else if (Level.Name.StartsWith("The City"))
            {
                GameObject mapCeiling = new GameObject("MapCeilingPrefab");
                mapCeiling.AddComponent <TLW.MapCeiling>();
                mapCeiling.transform.position   = new Vector3(0f, 210f, 0f);
                mapCeiling.transform.rotation   = Quaternion.identity;
                mapCeiling.transform.localScale = new Vector3(1400f, 20f, 1400f);
            }
        }

        roomInformation.UpdateLabels();
        Resources.UnloadUnusedAssets();
    }
Exemplo n.º 24
0
    private void callTitan(bool special = false)
    {
        if (!special && GameObject.FindGameObjectsWithTag("titan").Length > 6)
        {
            return;
        }
        GameObject[] array     = GameObject.FindGameObjectsWithTag("titanRespawn");
        ArrayList    arrayList = new ArrayList();

        foreach (GameObject gameObject in array)
        {
            if (gameObject.transform.parent.name == "titanRespawnCT")
            {
                arrayList.Add(gameObject);
            }
        }
        GameObject gameObject2 = (GameObject)arrayList[UnityEngine.Random.Range(0, arrayList.Count)];

        string[] array3 = new string[]
        {
            "TITAN_VER3.1"
        };
        GameObject gameObject3;

        if (FengGameManagerMKII.LAN)
        {
            gameObject3 = (GameObject)Network.Instantiate(CacheResources.Load(array3[UnityEngine.Random.Range(0, array3.Length)]), gameObject2.transform.position, gameObject2.transform.rotation, 0);
        }
        else
        {
            gameObject3 = Optimization.Caching.Pool.NetworkEnable(array3[UnityEngine.Random.Range(0, array3.Length)], gameObject2.transform.position, gameObject2.transform.rotation, 0);
        }
        if (special)
        {
            GameObject[] array4      = GameObject.FindGameObjectsWithTag("route");
            GameObject   gameObject4 = array4[UnityEngine.Random.Range(0, array4.Length)];
            while (gameObject4.name != "routeCT")
            {
                gameObject4 = array4[UnityEngine.Random.Range(0, array4.Length)];
            }
            gameObject3.GetComponent <TITAN>().setRoute(gameObject4);
            gameObject3.GetComponent <TITAN>().setAbnormalType(AbnormalType.Aberrant, false);
            gameObject3.GetComponent <TITAN>().activeRad = 0;
            gameObject3.GetComponent <TITAN>().toCheckPoint((Vector3)gameObject3.GetComponent <TITAN>().checkPoints[0], 10f);
        }
        else
        {
            float num  = 0.7f;
            float num2 = 0.7f;
            if (IN_GAME_MAIN_CAMERA.Difficulty != 0)
            {
                if (IN_GAME_MAIN_CAMERA.Difficulty == 1)
                {
                    num  = 0.4f;
                    num2 = 0.7f;
                }
                else if (IN_GAME_MAIN_CAMERA.Difficulty == 2)
                {
                    num  = -1f;
                    num2 = 0.7f;
                }
            }
            if (GameObject.FindGameObjectsWithTag("titan").Length == 5)
            {
                gameObject3.GetComponent <TITAN>().setAbnormalType(AbnormalType.Jumper, false);
            }
            else if (UnityEngine.Random.Range(0f, 1f) >= num)
            {
                if (UnityEngine.Random.Range(0f, 1f) < num2)
                {
                    gameObject3.GetComponent <TITAN>().setAbnormalType(AbnormalType.Jumper, false);
                }
                else
                {
                    gameObject3.GetComponent <TITAN>().setAbnormalType(AbnormalType.Crawler, false);
                }
            }
            gameObject3.GetComponent <TITAN>().activeRad = 200;
        }
        if (FengGameManagerMKII.LAN)
        {
            GameObject gameObject5 = (GameObject)Network.Instantiate(CacheResources.Load("FX/FXtitanSpawn"), gameObject3.transform.position, Quaternion.Euler(-90f, 0f, 0f), 0);
            gameObject5.transform.localScale = gameObject3.transform.localScale;
        }
        else
        {
            GameObject gameObject6 = Optimization.Caching.Pool.NetworkEnable("FX/FXtitanSpawn", gameObject3.transform.position, Quaternion.Euler(-90f, 0f, 0f), 0);
            gameObject6.transform.localScale = gameObject3.transform.localScale;
        }
    }
Exemplo n.º 25
0
 public void Create3DMG()
 {
     UnityEngine.Object.Destroy(this.part_3dmg);
     UnityEngine.Object.Destroy(this.part_3dmg_belt);
     UnityEngine.Object.Destroy(this.part_3dmg_gas_l);
     UnityEngine.Object.Destroy(this.part_3dmg_gas_r);
     UnityEngine.Object.Destroy(this.part_blade_l);
     UnityEngine.Object.Destroy(this.part_blade_r);
     if (this.myCostume.mesh_3dmg.Length > 0)
     {
         this.part_3dmg = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.mesh_3dmg));
         this.part_3dmg.transform.position = this.mount_3dmg.transform.position;
         this.part_3dmg.transform.rotation = this.mount_3dmg.transform.rotation;
         this.part_3dmg.transform.parent   = this.mount_3dmg.transform.parent;
         this.part_3dmg.renderer.material  = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
     }
     if (this.myCostume.mesh_3dmg_belt.Length > 0)
     {
         this.part_3dmg_belt = this.GenerateCloth(this.reference, "Character/" + this.myCostume.mesh_3dmg_belt);
         this.part_3dmg_belt.renderer.material = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
     }
     if (this.myCostume.mesh_3dmg_gas_l.Length > 0)
     {
         this.part_3dmg_gas_l = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.mesh_3dmg_gas_l));
         if (this.myCostume.uniform_type != UNIFORM_TYPE.CasualAHSS)
         {
             this.part_3dmg_gas_l.transform.position = this.mount_3dmg_gas_l.transform.position;
             this.part_3dmg_gas_l.transform.rotation = this.mount_3dmg_gas_l.transform.rotation;
             this.part_3dmg_gas_l.transform.parent   = this.mount_3dmg_gas_l.transform.parent;
         }
         else
         {
             this.part_3dmg_gas_l.transform.position = this.mount_3dmg_gun_mag_l.transform.position;
             this.part_3dmg_gas_l.transform.rotation = this.mount_3dmg_gun_mag_l.transform.rotation;
             this.part_3dmg_gas_l.transform.parent   = this.mount_3dmg_gun_mag_l.transform.parent;
         }
         this.part_3dmg_gas_l.renderer.material = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
     }
     if (this.myCostume.mesh_3dmg_gas_r.Length > 0)
     {
         this.part_3dmg_gas_r = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.mesh_3dmg_gas_r));
         if (this.myCostume.uniform_type != UNIFORM_TYPE.CasualAHSS)
         {
             this.part_3dmg_gas_r.transform.position = this.mount_3dmg_gas_r.transform.position;
             this.part_3dmg_gas_r.transform.rotation = this.mount_3dmg_gas_r.transform.rotation;
             this.part_3dmg_gas_r.transform.parent   = this.mount_3dmg_gas_r.transform.parent;
         }
         else
         {
             this.part_3dmg_gas_r.transform.position = this.mount_3dmg_gun_mag_r.transform.position;
             this.part_3dmg_gas_r.transform.rotation = this.mount_3dmg_gun_mag_r.transform.rotation;
             this.part_3dmg_gas_r.transform.parent   = this.mount_3dmg_gun_mag_r.transform.parent;
         }
         this.part_3dmg_gas_r.renderer.material = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
     }
     if (this.myCostume.weapon_l_mesh.Length > 0)
     {
         this.part_blade_l = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.weapon_l_mesh));
         this.part_blade_l.transform.position = this.mount_weapon_l.transform.position;
         this.part_blade_l.transform.rotation = this.mount_weapon_l.transform.rotation;
         this.part_blade_l.transform.parent   = this.mount_weapon_l.transform.parent;
         this.part_blade_l.renderer.material  = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
         if (this.part_blade_l.transform.Find("X-WeaponTrailA"))
         {
             this.part_blade_l.transform.Find("X-WeaponTrailA").GetComponent <XWeaponTrail>().Deactivate();
             this.part_blade_l.transform.Find("X-WeaponTrailB").GetComponent <XWeaponTrail>().Deactivate();
             if (base.gameObject.GetComponent <HERO>())
             {
                 base.gameObject.GetComponent <HERO>().leftbladetrail  = this.part_blade_l.transform.Find("X-WeaponTrailA").GetComponent <XWeaponTrail>();
                 base.gameObject.GetComponent <HERO>().leftbladetrail2 = this.part_blade_l.transform.Find("X-WeaponTrailB").GetComponent <XWeaponTrail>();
             }
         }
     }
     if (this.myCostume.weapon_r_mesh.Length > 0)
     {
         this.part_blade_r = (GameObject)UnityEngine.Object.Instantiate(CacheResources.Load("Character/" + this.myCostume.weapon_r_mesh));
         this.part_blade_r.transform.position = this.mount_weapon_r.transform.position;
         this.part_blade_r.transform.rotation = this.mount_weapon_r.transform.rotation;
         this.part_blade_r.transform.parent   = this.mount_weapon_r.transform.parent;
         this.part_blade_r.renderer.material  = CharacterMaterials.Materials[this.myCostume._3dmg_texture];
         if (this.part_blade_r.transform.Find("X-WeaponTrailA"))
         {
             this.part_blade_r.transform.Find("X-WeaponTrailA").GetComponent <XWeaponTrail>().Deactivate();
             this.part_blade_r.transform.Find("X-WeaponTrailB").GetComponent <XWeaponTrail>().Deactivate();
             if (base.gameObject.GetComponent <HERO>())
             {
                 base.gameObject.GetComponent <HERO>().rightbladetrail  = this.part_blade_r.transform.Find("X-WeaponTrailA").GetComponent <XWeaponTrail>();
                 base.gameObject.GetComponent <HERO>().rightbladetrail2 = this.part_blade_r.transform.Find("X-WeaponTrailB").GetComponent <XWeaponTrail>();
             }
         }
     }
 }
Exemplo n.º 26
0
 public static GameObject Instantiate(string name)
 {
     return(CacheResources.RCLoad(name));
 }
Exemplo n.º 27
0
    public void SpawnPlayerAt(string id, string find = "")
    {
        if (!CustomLevel.logicLoaded || !CustomLevel.customLevelLoaded)
        {
            NotSpawnPlayer(id);
            return;
        }

        myLastRespawnTag = find;
        Vector3 pos;
        var     rot = Quaternion.identity;

        if (find != string.Empty)
        {
            var positions = GameObject.FindGameObjectsWithTag(find);
            if (positions.Length > 0)
            {
                pos = positions[Random.Range(0, positions.Length)].transform.position;
            }
            else
            {
                pos = RespawnPositions.RandomHeroPos;
            }
        }
        else if (IN_GAME_MAIN_CAMERA.GameMode == GameMode.PVP_CAPTURE)
        {
            pos = checkpoint.transform.position;
        }
        else if (RCManager.racingSpawnPointSet)
        {
            pos = RCManager.racingSpawnPoint;
            rot = RCManager.racingSpawnPointRotation;
        }
        else if (Level.Name.StartsWith("Custom"))
        {
            var list = new List <Vector3>();
            switch (PhotonNetwork.player.RCteam)
            {
            case 0:
                for (var i = 0; i < 2; i++)
                {
                    var type = i == 0 ? "C" : "M";
                    foreach (var vec in CustomLevel.spawnPositions["Player" + type])
                    {
                        list.Add(vec);
                    }
                }

                break;

            case 1:
                using (var enumerator = CustomLevel.spawnPositions["PlayerC"].GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        var vec2 = enumerator.Current;
                        list.Add(vec2);
                    }
                }

                break;

            case 2:
                using (var enumerator = CustomLevel.spawnPositions["PlayerM"].GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        var vec2 = enumerator.Current;
                        list.Add(vec2);
                    }
                }

                break;

            default:
                foreach (var vec3 in CustomLevel.spawnPositions["PlayerM"])
                {
                    list.Add(vec3);
                }

                break;
            }

            if (list.Count > 0)
            {
                pos = list[Random.Range(0, list.Count)];
            }
            else
            {
                pos = RespawnPositions.RandomHeroPos;
            }
        }
        else
        {
            pos = RespawnPositions.RandomHeroPos;
        }

        var component = IN_GAME_MAIN_CAMERA.MainCamera;

        myLastHero = id.ToUpper();
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.Single)
        {
            if (IN_GAME_MAIN_CAMERA.singleCharacter == "TITAN_EREN")
            {
                component.SetMainObject(
                    ((GameObject)Instantiate(CacheResources.Load("TITAN_EREN"), pos, Quaternion.identity))
                    .GetComponent <TITAN_EREN>());
            }
            else
            {
                component.SetMainObject(((GameObject)Instantiate(CacheResources.Load("AOTTG_HERO 1"), pos, rot))
                                        .GetComponent <HERO>());
                if (IN_GAME_MAIN_CAMERA.singleCharacter == "SET 1" || IN_GAME_MAIN_CAMERA.singleCharacter == "SET 2" ||
                    IN_GAME_MAIN_CAMERA.singleCharacter == "SET 3")
                {
                    var heroCostume = CostumeConeveter.LocalDataToHeroCostume(IN_GAME_MAIN_CAMERA.singleCharacter);
                    heroCostume.Checkstat();
                    CostumeConeveter.HeroCostumeToLocalData(heroCostume, IN_GAME_MAIN_CAMERA.singleCharacter);
                    IN_GAME_MAIN_CAMERA.MainHERO.Setup.Init();

                    IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume      = heroCostume;
                    IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume.stat = heroCostume.stat;

                    IN_GAME_MAIN_CAMERA.MainHERO.Setup.SetCharacterComponent();
                    IN_GAME_MAIN_CAMERA.MainHERO.SetStat();
                    IN_GAME_MAIN_CAMERA.MainHERO.SetSkillHudPosition();
                }
                else
                {
                    for (var i = 0; i < HeroCostume.costume.Length; i++)
                    {
                        if (HeroCostume.costume[i].name.ToUpper() == IN_GAME_MAIN_CAMERA.singleCharacter.ToUpper())
                        {
                            var num = HeroCostume.costume[i].id + CheckBoxCostume.costumeSet - 1;
                            if (HeroCostume.costume[num].name != HeroCostume.costume[i].name)
                            {
                                num = HeroCostume.costume[i].id + 1;
                            }

                            IN_GAME_MAIN_CAMERA.MainHERO.Setup.Init();
                            IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume      = HeroCostume.costume[num];
                            IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume.stat =
                                HeroStat.getInfo(HeroCostume.costume[num].name.ToUpper());
                            IN_GAME_MAIN_CAMERA.MainHERO.Setup.SetCharacterComponent();
                            IN_GAME_MAIN_CAMERA.MainHERO.SetStat();
                            IN_GAME_MAIN_CAMERA.MainHERO.SetSkillHudPosition();
                            break;
                        }
                    }
                }
            }
        }
        else
        {
            var hero = Pool.NetworkEnable("AOTTG_HERO 1", pos, Quaternion.identity).GetComponent <HERO>();
            component.SetMainObject(hero);
            id = id.ToUpper();
            if (id == "SET 1" || id == "SET 2" || id == "SET 3")
            {
                var heroCostume2 = CostumeConeveter.LocalDataToHeroCostume(id);
                heroCostume2.Checkstat();
                CostumeConeveter.HeroCostumeToLocalData(heroCostume2, id);
                IN_GAME_MAIN_CAMERA.MainHERO.Setup.Init();

                IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume      = heroCostume2;
                IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume.stat = heroCostume2.stat;

                IN_GAME_MAIN_CAMERA.MainHERO.Setup.SetCharacterComponent();
                IN_GAME_MAIN_CAMERA.MainHERO.SetStat();
                IN_GAME_MAIN_CAMERA.MainHERO.SetSkillHudPosition();
            }
            else
            {
                for (var j = 0; j < HeroCostume.costume.Length; j++)
                {
                    if (HeroCostume.costume[j].name.ToUpper() == id.ToUpper())
                    {
                        var num2 = HeroCostume.costume[j].id;
                        if (id.ToUpper() != "AHSS")
                        {
                            num2 += CheckBoxCostume.costumeSet - 1;
                        }

                        if (HeroCostume.costume[num2].name != HeroCostume.costume[j].name)
                        {
                            num2 = HeroCostume.costume[j].id + 1;
                        }

                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.Init();
                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume      = HeroCostume.costume[num2];
                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume.stat =
                            HeroStat.getInfo(HeroCostume.costume[num2].name.ToUpper());
                        IN_GAME_MAIN_CAMERA.MainHERO.Setup.SetCharacterComponent();
                        IN_GAME_MAIN_CAMERA.MainHERO.SetStat();
                        IN_GAME_MAIN_CAMERA.MainHERO.SetSkillHudPosition();
                        break;
                    }
                }
            }

            CostumeConeveter.HeroCostumeToPhotonData(IN_GAME_MAIN_CAMERA.MainHERO.Setup.myCostume,
                                                     PhotonNetwork.player);
            if (IN_GAME_MAIN_CAMERA.GameMode == GameMode.PVP_CAPTURE)
            {
                IN_GAME_MAIN_CAMERA.MainT.position += new Vector3(Random.Range(-20, 20), 2f, Random.Range(-20, 20));
            }

            PhotonNetwork.player.Dead    = false;
            PhotonNetwork.player.IsTitan = false;
        }

        component.enabled = true;

        IN_GAME_MAIN_CAMERA.MainCamera.setHUDposition();
        IN_GAME_MAIN_CAMERA.SpecMov.disable = true;
        IN_GAME_MAIN_CAMERA.Look.disable    = true;
        component.gameOver = false;
        Screen.lockCursor  = IN_GAME_MAIN_CAMERA.CameraMode >= CameraType.TPS;
        Screen.showCursor  = false;
        ShowHUDInfoCenter(string.Empty);
    }