Example #1
0
 private void OnHitSnd(int brickManBy)
 {
     if (deltaTime > damageVoiceTimeout)
     {
         AudioClip audioClip = null;
         if (!isThirdPerson)
         {
             audioClip = ((!MyInfoManager.Instance.IsYang) ? VoiceManager.Instance.Get(hitVoc[Random.Range(0, hitVoc.Length)]) : VoiceManager.Instance.Get2(hitVoc[Random.Range(0, hitVoc.Length)]));
         }
         else
         {
             GameObject gameObject = BrickManManager.Instance.Get(brickManBy);
             if (gameObject != null)
             {
                 LookCoordinator component = gameObject.GetComponent <LookCoordinator>();
                 if (component != null)
                 {
                     audioClip = ((!component.IsYang) ? VoiceManager.Instance.Get(cryVoc[Random.Range(0, cryVoc.Length)]) : VoiceManager.Instance.Get2(cryVoc[Random.Range(0, cryVoc.Length)]));
                 }
             }
         }
         if (null != audioClip)
         {
             audioSource.PlayOneShot(audioClip);
         }
         ResetDamageVoiceTimeout();
     }
 }
Example #2
0
 public override void StartItem()
 {
     if (IsMyItem())
     {
         GameObject gameObject = GameObject.Find("Me");
         if (null != gameObject)
         {
             LocalController component = gameObject.GetComponent <LocalController>();
             if (component != null)
             {
                 component.EquipSmokeBomb();
             }
         }
     }
     else
     {
         GameObject gameObject2 = BrickManManager.Instance.Get(useUserSeq);
         if (gameObject2 != null)
         {
             LookCoordinator component2 = gameObject2.GetComponent <LookCoordinator>();
             if (component2 != null)
             {
                 component2.EquipSmokeBomb();
             }
         }
     }
 }
Example #3
0
    private void OnDeath(int manID)
    {
        if (null != audioSource && audioSource.isPlaying)
        {
            audioSource.Stop();
        }
        AudioClip audioClip = null;

        if (!isThirdPerson)
        {
            audioClip = ((!MyInfoManager.Instance.IsYang) ? VoiceManager.Instance.Get(deathVoc[Random.Range(0, deathVoc.Length)]) : VoiceManager.Instance.Get2(deathVoc[Random.Range(0, deathVoc.Length)]));
        }
        else
        {
            GameObject gameObject = BrickManManager.Instance.Get(manID);
            if (gameObject != null)
            {
                LookCoordinator component = gameObject.GetComponent <LookCoordinator>();
                if (component != null)
                {
                    audioClip = ((!component.IsYang) ? VoiceManager.Instance.Get(deathVoc[Random.Range(0, deathVoc.Length)]) : VoiceManager.Instance.Get2(deathVoc[Random.Range(0, deathVoc.Length)]));
                }
            }
        }
        if (null != audioClip && null != audioSource)
        {
            audioSource.PlayOneShot(audioClip);
        }
        ResetDamageVoiceTimeout();
    }
 private void enableWingItem(bool enable)
 {
     itemEnable = enable;
     if (IsMyItem())
     {
         GameObject gameObject = GameObject.Find("Me");
         if (null != gameObject)
         {
             EquipCoordinator component = gameObject.GetComponent <EquipCoordinator>();
             if (component != null)
             {
                 component.enableWingEffect(enable, this);
             }
         }
     }
     else
     {
         GameObject gameObject2 = BrickManManager.Instance.Get(useUserSeq);
         if (gameObject2 != null)
         {
             LookCoordinator component2 = gameObject2.GetComponent <LookCoordinator>();
             if (component2 != null)
             {
                 component2.enableWingEffect(enable, this);
             }
         }
     }
 }
Example #5
0
 private void Update()
 {
     if (killInfo != null)
     {
         deltaTime += Time.deltaTime;
         if (deltaTime > hideTime)
         {
             killInfo  = null;
             deltaTime = 0f;
             show      = false;
         }
         else if (!show && deltaTime > showTime)
         {
             show = true;
             GameObject gameObject = BrickManManager.Instance.Get(killInfo.KillerSequence);
             if (gameObject != null)
             {
                 LookCoordinator component = gameObject.GetComponent <LookCoordinator>();
                 if (component != null)
                 {
                     if (component.IsYang)
                     {
                         VoiceManager.Instance.Play2(hahaVoc[Random.Range(0, hahaVoc.Length)]);
                     }
                     else
                     {
                         VoiceManager.Instance.Play0(hahaVoc[Random.Range(0, hahaVoc.Length)]);
                     }
                 }
             }
         }
     }
 }
 public void Reinit()
 {
     foreach (KeyValuePair <int, GameObject> item in dicBrickMan)
     {
         LookCoordinator component = item.Value.GetComponent <LookCoordinator>();
         if (null != component)
         {
             component.ChangeWeapon(RoomManager.Instance.DefaultWeaponType);
         }
     }
 }
Example #7
0
 public void Start()
 {
     rotator = mySelf.GetComponent <AutoRotator>();
     cordi   = mySelf.GetComponent <LookCoordinator>();
     cordi.Init(mirror: true);
     cordi.TestGender = true;
     string[] usings = MyInfoManager.Instance.GetUsings();
     for (int i = 0; i < usings.Length; i++)
     {
         cordi.Equip(usings[i]);
     }
     cordi.TestGender    = false;
     Weapon.isInitialize = true;
     cordi.ChangeWeapon(Weapon.TYPE.MAIN);
     Weapon.isInitialize = false;
     flip      = false;
     deltaTime = 0f;
 }
    public GameObject AddBrickMan(BrickManDesc desc)
    {
        Vector3 position = new Vector3(0f, 11000f, 0f);

        if (freeInvisiblePositionQ.Count <= 0)
        {
            Debug.LogError("No more free Invisible Position ");
        }
        else
        {
            position = freeInvisiblePositionQ.Dequeue();
        }
        GameObject gameObject = Object.Instantiate((Object)brickMan, position, Quaternion.Euler(0f, 0f, 0f)) as GameObject;

        if (null == gameObject)
        {
            Debug.LogError("Fail to instantiate a brick man ");
            return(null);
        }
        PlayerProperty component = gameObject.GetComponent <PlayerProperty>();

        if (null == component)
        {
            Object.DestroyImmediate(gameObject);
            Debug.LogError("New brickman doesnt have PlayerProperty ");
            return(null);
        }
        component.Desc = desc;
        component.InvisiblePosition = position;
        TPController component2 = gameObject.GetComponent <TPController>();

        if (null == component2)
        {
            Object.DestroyImmediate(gameObject);
            Debug.LogError("New brickman doesnt have ThirdPersonController");
            return(null);
        }
        Camera camera = null;

        Camera[] componentsInChildren = gameObject.GetComponentsInChildren <Camera>();
        if (componentsInChildren != null)
        {
            string value = "Near";
            if (Application.loadedLevelName == "Result4Defense")
            {
                value = "Far";
            }
            int num = 0;
            while (camera == null && num < componentsInChildren.Length)
            {
                if (componentsInChildren[num].name.Contains(value))
                {
                    camera = componentsInChildren[num];
                }
                num++;
            }
        }
        if (null == camera)
        {
            Object.DestroyImmediate(gameObject);
            Debug.LogError(" New brickman doesnt have Overlay camera ");
            return(null);
        }
        if (freeOverlayQ.Count <= 0)
        {
            Debug.LogError("No more freeOverlay ");
        }
        camera.enabled       = true;
        camera.targetTexture = freeOverlayQ.Dequeue();
        Weapon.isInitialize  = true;
        LookCoordinator component3 = gameObject.GetComponent <LookCoordinator>();

        if (null == component3)
        {
            Object.DestroyImmediate(gameObject);
            Debug.LogError("New brickman doesnt have LookCoordinator");
            return(null);
        }
        component3.Init(mirror: false);
        for (int i = 0; i < desc.Equipment.Length; i++)
        {
            TItem tItem = TItemManager.Instance.Get <TItem>(desc.Equipment[i]);
            if (tItem != null)
            {
                string itemCode = desc.Equipment[i];
                if (tItem.type == TItem.TYPE.WEAPON)
                {
                    TWeapon tWeapon = (TWeapon)tItem;
                    int     num2    = 0;
                    while (desc.WpnChg != null && num2 < desc.WpnChg.Length)
                    {
                        TItem tItem2 = TItemManager.Instance.Get <TItem>(desc.WpnChg[num2]);
                        if (tItem2 != null && tItem2.type == TItem.TYPE.WEAPON)
                        {
                            TWeapon tWeapon2 = (TWeapon)tItem2;
                            if (tWeapon.slot == tWeapon2.slot)
                            {
                                itemCode = desc.WpnChg[num2];
                            }
                        }
                        num2++;
                    }
                    int num3 = 0;
                    while (desc.DrpItm != null && num3 < desc.DrpItm.Length)
                    {
                        TItem tItem3 = TItemManager.Instance.Get <TItem>(desc.DrpItm[num3]);
                        if (tItem3 != null && tItem3.type == TItem.TYPE.WEAPON)
                        {
                            TWeapon tWeapon3 = (TWeapon)tItem3;
                            if (tWeapon.slot == tWeapon3.slot)
                            {
                                itemCode = desc.DrpItm[num3];
                            }
                        }
                        num3++;
                    }
                }
                component3.Equip(itemCode);
            }
        }
        component3.ChangeWeapon(RoomManager.Instance.DefaultWeaponType);
        dicBrickMan.Add(desc.Seq, gameObject);
        Weapon.isInitialize = false;
        return(gameObject);
    }