public void createRecieverObj(string cnam)
    {
        RecieverObjCtrl recieverObjCtrl = this.targetObj.GetComponentInChildren <RecieverObjCtrl>();
        GameObject      gameObject;
        MeshRenderer    meshRenderer;

        if (recieverObjCtrl == null)
        {
            gameObject   = new GameObject("recieverObj");
            meshRenderer = gameObject.AddComponent <MeshRenderer>();
            MeshFilter meshFilter = gameObject.AddComponent <MeshFilter>();
            recieverObjCtrl = gameObject.AddComponent <RecieverObjCtrl>();
        }
        else
        {
            gameObject   = recieverObjCtrl.gameObject;
            meshRenderer = gameObject.GetComponent <MeshRenderer>();
            MeshFilter meshFilter = gameObject.GetComponent <MeshFilter>();
        }
        gameObject.transform.parent = this.targetObj.transform;
        recieverObjCtrl.light       = base.transform;
        this.recieverObj            = gameObject;
        meshRenderer.material       = recieverObjCtrl.createMat();
        recieverObjCtrl.updatamat();
        recieverObjCtrl.skintarget = recieverObjCtrl.transform.parent.GetComponentInChildren <SkinnedMeshRenderer>();
        recieverObjCtrl.setclip(cnam);
        recieverObjCtrl.updatashadowtex();
        recieverObjCtrl.initialize(gameObject.transform.localPosition, gameObject.transform.rotation);
        recieverObjCtrl.updatamesh();
        recieverObjCtrl.updataproj1(this.localProjMat());
    }
Exemple #2
0
 private void Awake()
 {
     if (this.character == null)
     {
         this.character = base.GetComponent <Units>();
     }
     if (this.animator == null)
     {
         this.animator = base.GetComponentInChildren <Animator>();
     }
     if (this.animator != null)
     {
         this.animator.logWarnings = false;
     }
     this.animplayer = base.GetComponent <AnimPlayer>();
     if (GlobalSettings.meshanim)
     {
         if (this.animplayer != null)
         {
             this.usingmeshanim = true;
         }
         else
         {
             this.usingmeshanim = false;
         }
     }
     else
     {
         this.usingmeshanim = false;
     }
     this.roc = this.character.GetComponentInChildren <RecieverObjCtrl>();
 }
Exemple #3
0
 protected override void OnCreate()
 {
     this.data          = base.AddUnitComponent <HeroDataManager>(!Singleton <PvpManager> .Instance.IsInPvp);
     this.EquipPackage  = base.AddUnitComponent <HeroEquipPackage>();
     this.atkController = base.AddUnitComponent <HeroAttackController>();
     base.OnCreate();
     base.ChangeLayer("Unit");
     this.musicid = this.data.GetData <string>(DataType.MusicId);
     this.m_hv    = base.gameObject.GetComponent <HeroVoicePlayer>();
     if (this.m_hv == null)
     {
         this.m_hv = base.gameObject.AddComponent <HeroVoicePlayer>();
     }
     if (this.m_model != null)
     {
         eventPlayerSound eventPlayerSound = this.m_model.gameObject.GetComponent <eventPlayerSound>();
         if (eventPlayerSound == null)
         {
             eventPlayerSound = this.m_model.gameObject.AddComponent <eventPlayerSound>();
         }
         eventPlayerSound.units  = this;
         this.m_eventPlayerSound = eventPlayerSound;
         HeroVoicePlayer component = this.m_model.gameObject.GetComponent <HeroVoicePlayer>();
         if (component != null)
         {
             component.enabled = false;
         }
     }
     if (RecieverObjCtrl.usefakeshadow)
     {
         if (this.roc == null)
         {
             this.roc = base.GetComponentInChildren <RecieverObjCtrl>();
         }
         if (this.roc == null)
         {
             GameObject   gameObject   = new GameObject("recieverObj_auto");
             MeshRenderer meshRenderer = gameObject.AddComponent <MeshRenderer>();
             meshRenderer.enabled = false;
             MeshFilter meshFilter = gameObject.AddComponent <MeshFilter>();
             meshFilter.mesh             = null;
             meshFilter.sharedMesh       = null;
             gameObject.transform.parent = base.transform;
             this.roc            = gameObject.AddComponent <RecieverObjCtrl>();
             this.roc.skintarget = base.GetComponentInChildren <SkinnedMeshRenderer>();
             this.roc.updatamesh3();
             this.roc.doStart();
         }
         else
         {
             this.roc.skintarget = base.GetComponentInChildren <SkinnedMeshRenderer>();
             this.roc.updatamesh3();
             this.roc.doStart();
         }
     }
 }
Exemple #4
0
 protected override void OnInit(bool isRebirth = false)
 {
     if (!base.MirrorState)
     {
         this.heroData = Singleton <PvpManager> .Instance.GetHeroInfoData(this.unique_id);
     }
     base.OnInit(isRebirth);
     this.m_fLiveTime = -1f;
     this.m_fLeftTime = 0f;
     this.musicid     = this.data.GetData <string>(DataType.MusicId);
     if (this.m_hv != null)
     {
         this.m_hv.init(this.musicid);
     }
     if (RecieverObjCtrl.usefakeshadow)
     {
         if (this.roc == null)
         {
             this.roc = base.GetComponentInChildren <RecieverObjCtrl>();
         }
         if (this.roc != null)
         {
             string[] array = base.name.Split(new char[]
             {
                 '+'
             });
             this.roc.setnpcid(array[0]);
         }
     }
     if (this.InitCount == 0)
     {
         AudioMgr.loadSoundBank_Skill(this.musicid, false, HeroSkins.GetRealHeroSkin(base.TeamType, base.model_id));
     }
     if (this.m_eventPlayerSound != null)
     {
         this.m_eventPlayerSound.isplayer = this.isPlayer;
     }
     if (this.isPlayer)
     {
         base.controllerType = 1;
         AudioMgr.AddLisener(base.gameObject);
         AudioMgr.loadLanguageSoundBank(this.musicid, HeroSkins.GetRealHeroSkin(base.TeamType, base.model_id));
     }
     else
     {
         base.controllerType = 0;
     }
     if (!base.MirrorState)
     {
     }
     this.InitCount++;
     this.TryInitHeroVisibleOnReplay(isRebirth);
 }
 public void EndGame()
 {
     if (this._isEndGame)
     {
         return;
     }
     this._isEndGame = true;
     GameManager.ShowShadow(false);
     GameManager.SetGameState(GameState.Game_None);
     this.UninitAllModules();
     MobaMessageManager.UnRegistMessage((ClientMsg)25009, new MobaMessageFunc(this.OnSceneLoadComplete));
     if (GlobalSettings.FogMode >= 2 && FOWSystem.instance != null)
     {
         FOWSystem.Instance.OnDestroy();
     }
     HomeGCManager.Instance.ClearBattleResouces();
     RecieverObjCtrl.releaseAllTex();
 }
Exemple #6
0
 protected override void OnUpdate(float delta)
 {
     base.OnUpdate(delta);
     this.UpdateMirrorState(delta);
     if (this.ani != null)
     {
         AnimatorStateInfo currentAnimatorStateInfo = this.ani.GetCurrentAnimatorStateInfo(0);
         float             num = currentAnimatorStateInfo.normalizedTime;
         num -= (float)((int)currentAnimatorStateInfo.normalizedTime);
         if (this.roc != null)
         {
             this.roc.setframe(num * 64f);
         }
     }
     if (!this.started)
     {
         this.started = true;
     }
     if (this.ani == null)
     {
         this.ani = base.GetComponentInChildren <Animator>();
     }
     AnimationInfo[] currentAnimationClipState = this.ani.GetCurrentAnimationClipState(0);
     if (currentAnimationClipState != null && currentAnimationClipState.Length >= 1 && this.roc != null)
     {
         this.roc.setclip(currentAnimationClipState[0].clip.name);
     }
     if (Input.GetKeyUp(KeyCode.F))
     {
         if (this.roc == null)
         {
             this.roc = base.GetComponentInChildren <RecieverObjCtrl>();
         }
         if (this.roc == null)
         {
             if (this.heroData != null)
             {
             }
             return;
         }
         this.roc.setvis(false);
     }
 }