Exemple #1
0
        void Update()
        {
            if (m_StartAct)
            {
                SwingHand();
            }
            else
            {
                m_CurTime += GetActDtTime();
                if (m_CurTime >= DtTime)
                {
                    if (m_Monster.TriggerSecondAct())
                    {
                        m_Monster.SetAnimFloat(GameConstVal.SpeedSymbolStr, 1.0f);
                        m_CurTime = 0;
                        m_Monster.SetSpeed(Vector2.zero);
                        m_Monster.PlayAnim(GameConstVal.Skill02);
                        m_StartAct       = true;
                        m_InstanceBullet = true;
                        m_Effect.gameObject.SetActive(true);
                        m_Monster.SetAnimFloat(GameConstVal.SpeedSymbolStr, 0.0f);

                        Vector3 vec = m_Player.transform.position - transform.position;
                        transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(vec, Vector3.up));
                    }
                }
            }
        }
        private void FlushCD()
        {
            double leftMills = Global.gApp.gSystemMgr.GetMiscMgr().lastAdEnegyMills + m_AdAddEnergyCD * 1000 - DateTimeUtil.GetMills(DateTime.Now);

            if (leftMills > 0 && m_AdAddEnergyTimesLimit - Global.gApp.gSystemMgr.GetMiscMgr().adEnegyTimes > 0)
            {
                DelayCallBack dcb      = gameObject.AddComponent <DelayCallBack>();
                int           leftSecs = (int)Math.Round(leftMills / 1000);
                AdBtntxt.text.text = EZMath.FormateTime(leftSecs);
                if (leftSecs > 0)
                {
                    m_AdBtn.button.interactable = false;
                }
                dcb.SetCallTimes(leftSecs);
                dcb.SetAction(() =>
                {
                    leftMills = Global.gApp.gSystemMgr.GetMiscMgr().lastAdEnegyMills + m_AdAddEnergyCD * 1000 - DateTimeUtil.GetMills(DateTime.Now);
                    leftSecs  = (int)Math.Round(leftMills / 1000);
                    if (leftSecs > 0)
                    {
                        AdBtntxt.text.text          = EZMath.FormateTime(leftSecs);
                        m_AdBtn.button.interactable = false;
                    }
                    else
                    {
                        AdBtntxt.text.text          = "Get";
                        m_AdBtn.button.interactable = true;
                    }
                }, 1f);
            }
            else
            {
                AdBtntxt.text.text = "Get";
            }
        }
Exemple #3
0
        public void AddArrowEffect(bool visible, PylonEle fromPylonEle)
        {
            if (m_ArrowEffect == null)
            {
                m_ArrowEffect = Global.gApp.gResMgr.InstantiateObj(EffectConfig.Eletower_02_zhiyin).GetComponent <RepreatEffect>();
            }
            if (visible)
            {
                int index = fromPylonEle.GetIndex();
                if (index == m_PylonEles.Length - 1)
                {
                    m_Symbol = -1;
                }
                else if (index == 0)
                {
                    m_Symbol = 1;
                }
                int      nextIndex  = index + m_Symbol;
                PylonEle toPylonEle = m_PylonEles[nextIndex];

                Vector3 dtVec3 = toPylonEle.transform.position - fromPylonEle.transform.position;
                float   angleZ = EZMath.SignedAngleBetween(dtVec3, Vector3.up);
                m_ArrowEffect.transform.localEulerAngles = new Vector3(0, 0, angleZ + 90);
                m_ArrowEffect.transform.position         = fromPylonEle.transform.position + dtVec3 / 2;
                float length = dtVec3.magnitude;
                m_ArrowEffect.transform.localScale = new Vector3(length, 1, 1);
                m_ArrowEffect.SetLength(length);
            }
            m_ArrowEffect.gameObject.SetActive(visible);
        }
Exemple #4
0
 private void SetLockMonster(Monster monster)
 {
     m_LockCampsiteMonster = monster;
     if (monster != null)
     {
         m_Gun.enabled = true;
         Vector3 dir = monster.transform.position - transform.position;
         dir.z = 0;
         float   angleZ     = EZMath.SignedAngleBetween(dir, Vector3.up);
         Vector3 eulerAngle = transform.eulerAngles;
         float   dtAngle    = angleZ - eulerAngle.z;
         if (dtAngle > 180f)
         {
             dtAngle -= 360f;
         }
         if (dtAngle < -180)
         {
             dtAngle += 360f;
         }
         angleZ = eulerAngle.z + dtAngle * BaseScene.GetDtTime() * 15;
         transform.eulerAngles = new Vector3(0, 0, angleZ);
         PlayFight();
     }
     else
     {
         PlayIdle();
     }
 }
Exemple #5
0
 public void ForceFaceToEnemy()
 {
     if (m_LockGameEnemy)
     {
         float angleZ = EZMath.SignedAngleBetween(m_LockGameEnemy.transform.position - m_RotateRoleNode.position, Vector3.up);
         CalcAngles(angleZ, true);
     }
 }
Exemple #6
0
        public override void Init(GameObject player, Wave wave, Monster monster)
        {
            base.Init(player, wave, monster);
            m_InAnimAct = false;
            Vector3 speedVec = m_Player.transform.position - transform.position;

            speedVec = speedVec.normalized;
            transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(speedVec, Vector3.up));
        }
Exemple #7
0
        void Update()
        {
            float dtTime = BaseScene.GetDtTime();

            m_CurTime = m_CurTime + dtTime;

            if (m_StartAct)
            {
                if (dtTime == 0)
                {
                    m_Monster.SetSpeed(Vector2.zero);
                    return;
                }
                JumpToMainPlayer();
            }
            else if (!m_InAnimAct)
            {
                if (!m_StartAct)
                {
                    m_CurTime = m_CurTime + BaseScene.GetDtTime();
                    if (m_CurTime >= DtTime && m_Monster.TriggerSecondAct())
                    {
                        m_CurTime = 0;
                        m_Monster.SetSpeed(Vector2.zero);
                        m_Monster.PlayAnim(GameConstVal.Skill01, -1, 0);
                        m_StartAct  = true;
                        m_InAnimAct = true;
                        Vector3 speedVec = m_Player.transform.position - transform.position;
                        transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(speedVec, Vector3.up));
                        m_LockSpeed   = speedVec.normalized * 3;
                        m_LockPos     = m_Player.transform.position;
                        m_CurPosition = transform.position;
                        GetComponent <Collider2D>().enabled    = false;
                        GetComponent <Rigidbody2D>().simulated = false;
                        m_InstanceBullet = false;
                        InitLockEffect();
                    }
                }
            }
            else
            {
                m_CurTime = m_CurTime + BaseScene.GetDtTime();
                if (m_CurTime >= m_AnimTime)
                {
                    InstanceBullet();
                    GetComponent <Collider2D>().enabled    = true;
                    GetComponent <Rigidbody2D>().simulated = true;
                    m_Monster.PlayAnim(GameConstVal.Run);
                    m_Monster.EndSecondAct();
                    m_CurTime   = 0;
                    m_InAnimAct = false;
                    m_StartAct  = false;
                }
            }
        }
Exemple #8
0
        void CalcPos()
        {
            float magnitude = (m_StartMonster.transform.position - m_EndMonster.transform.position).magnitude;

            transform.localScale = new Vector3(1, 1, magnitude / 2.3f);
            Vector3 newPos = m_StartMonster.GetBodyNode().position;

            transform.position = newPos;
            float angleZ = EZMath.SignedAngleBetween(m_EndMonster.transform.position - m_StartMonster.transform.position, Vector3.up);

            transform.localEulerAngles = new Vector3(0, 0, angleZ + 90);
        }
Exemple #9
0
        private void HurlToMainPlayer()
        {
            Vector3 speedVec = m_Player.transform.position - transform.position;

            transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(speedVec, Vector3.up));
            if (m_CurTime >= m_DelayTime)
            {
                m_StartAct = false;
                GameObject rugbyBall = Instantiate(RugbyBall);
                rugbyBall.GetComponent <RugbyBullet>().Init(1, FirePoint, m_Player.transform.position - FirePoint.position);
            }
        }
 private void FaceToEnemyImp()
 {
     if (m_RelativeSpace == FaceMode.FaceToMonster)
     {
         float angleZ = EZMath.SignedAngleBetween(m_DstUpVec, Vector3.up);
         CalcAnglesWorld(angleZ);
     }
     else
     {
         CalcAnglesLocal(0);
     }
 }
        void Update()
        {
            float dtTime = BaseScene.GetDtTime();

            if (m_StartAct)
            {
                m_Monster.SetSpeed(Vector2.zero);
                if (dtTime == 0)
                {
                    return;
                }
                m_CurTime = m_CurTime + dtTime;
                FireToMainPlayer();

                Vector3 speedVec = m_Player.transform.position - transform.position;
                transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(speedVec, Vector3.up));
            }
            else if (!m_InAnimAct)
            {
                m_CurTime += GetActDtTime();
                if (m_CurTime >= DtTime)
                {
                    if (m_Monster.TriggerFirstAct())
                    {
                        m_CurTime = 0;
                        m_Monster.SetSpeed(Vector2.zero);
                        m_Monster.PlayAnim(GameConstVal.Skill01);
                        m_StartAct  = true;
                        m_InAnimAct = true;
                        m_ResetAnim = true;
                    }
                }
            }
            else if (m_InAnimAct)
            {
                m_CurTime = m_CurTime + dtTime;
                m_Monster.SetSpeed(Vector2.zero);
                if (m_ResetAnim && m_CurTime > m_ResetAnimTime)
                {
                    m_ResetAnim = false;
                    m_Monster.PlayAnim(GameConstVal.Run);
                }
                if (m_CurTime >= m_AnimTime)
                {
                    m_Monster.PlayAnim(GameConstVal.Run);
                    m_Monster.EndFirstAct();
                    m_CurTime   = 0;
                    m_InAnimAct = false;
                    m_ResetAnim = false;
                }
            }
        }
Exemple #12
0
 private void FaceToEnemyImp()
 {
     if (m_LockGameEnemy)
     {
         float angleZ = EZMath.SignedAngleBetween(m_LockGameEnemy.transform.position - m_RotateRoleNode.position, Vector3.up);
         CalcAngles(angleZ);
         m_WeaponMgr.SetCurMainWeaponEnabled(true);
     }
     else
     {
         m_WeaponMgr.SetCurMainWeaponEnabled(false);
         //CalcAngles(0);
     }
 }
Exemple #13
0
        /// <summary>
        /// 寻路生效
        /// </summary>
        public void EnablePath()
        {
            if (m_AiPath.enabled)
            {
                return;
            }
            Transform targetNode = GetTargetNode();

            transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(targetNode.position - transform.position, Vector3.up));
            m_AiPath.enabled           = true;
            m_rvoController.enabled    = true;
            m_seeker.StartPath(transform.position, targetNode.position);
            PathInit.curPathNum++;
        }
Exemple #14
0
        public void ArriveAtDst(Vector3 position)
        {
            m_CurTime          = 0;
            transform.position = position;
            GameObject effect = Global.gApp.gResMgr.InstantiateObj(EffectConfig.Skill01_2011);

            effect.transform.position = position;
            Vector3 speedVec = m_Player.transform.position - transform.position;

            transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(speedVec, Vector3.up));
            m_Monster.PlayAnim(GameConstVal.Skill02, -1, 0f);
            m_Monster.SetAnimFloat(GameConstVal.SpeedSymbolStr, 1.0f);
            m_AnimTime = m_DelayTime;
        }
Exemple #15
0
        private void AddWallImp(PylonEle fromPylonEle, PylonEle toPylonEle)
        {
            //m_CurWall
            if (m_CurWall == null)
            {
                m_CurWall = Global.gApp.gResMgr.InstantiateObj(EffectConfig.PylonWallEffect).transform;
            }
            Vector3 dtVec3 = toPylonEle.transform.position - fromPylonEle.transform.position;
            float   angleZ = EZMath.SignedAngleBetween(dtVec3, Vector3.up);

            m_CurWall.localEulerAngles = new Vector3(0, 0, angleZ + 90);
            m_CurWall.position         = fromPylonEle.transform.position + dtVec3 / 2;
            m_CurWall.localScale       = new Vector3(dtVec3.magnitude / 6.45f, 1, 1);
            m_CurWall.gameObject.SetActive(true);
        }
        public override void Update()
        {
            float dtTime = BaseScene.GetDtTime();

            if (!m_InDeath && dtTime > 0)
            {
                Vector3 dtPos = m_PlayerPos - transform.position;
                transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(dtPos, Vector3.up));
                m_Rigidbody2D.velocity     = dtPos.normalized * m_Speed;
            }
            else
            {
                m_Rigidbody2D.velocity = Vector2.zero;
            }
        }
Exemple #17
0
        public static string FormatTime(float time)
        {
            int    intVal   = (int)time;
            int    pointVal = (int)((time - intVal) * 100.0f);
            string pointStr;

            if (pointVal >= 10)
            {
                pointStr = pointVal.ToString();
            }
            else
            {
                pointStr = "0" + pointVal.ToString();
            }
            string intValStr = EZMath.FormateTime(intVal);

            return(intValStr + "." + pointStr);
        }
Exemple #18
0
 private void RandomAct()
 {
     if (!m_StartAct)
     {
         m_StartAct = true;
         m_Monster.PlayAnim(GameConstVal.Run);
         float randomAngle = Mathf.Deg2Rad * Random.Range(0, 360);
         m_SpeedVec = new Vector2(Mathf.Cos(randomAngle), Mathf.Sin(randomAngle)) * Speed;
         m_ActTime  = Random.Range(m_StrollTime - 0.5f, m_StrollTime + 0.5f);
         transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(m_SpeedVec, Vector3.up));
     }
     else
     {
         m_StartAct = false;
         m_Monster.PlayAnim(GameConstVal.Idle);
         m_SpeedVec = Vector2.zero;
         m_ActTime  = Random.Range(m_IdleTime - 0.2f, m_IdleTime + 0.1f);
     }
 }
Exemple #19
0
        public void CalcCurAnim(float sx, float sy)
        {
            if (BaseScene.GetDtTime() <= 0)
            {
                return;
            }
            if (sx != 0 || sy != 0)
            {
                Vector3 speedV = new Vector3(sx, sy, 0);
                float   angle  = EZMath.SignedAngleBetween(speedV, Vector3.up);

                m_Player.angle = angle;

                // Debug.Log(angle);

                Vector3 roleEulerAngle = m_RotateRoleNode.eulerAngles;
                float   roleAngleZ     = roleEulerAngle.z;
                float   relativeAngleZ = angle - roleAngleZ;
                relativeAngleZ = relativeAngleZ >= 0 ? relativeAngleZ : relativeAngleZ + 360;
                if (relativeAngleZ <= 45 || relativeAngleZ >= 315)
                {
                    PlayDAnim(GameConstVal.Run);
                }
                else if (relativeAngleZ >= 45 && relativeAngleZ <= 135)
                {
                    PlayDAnim(GameConstVal.Run_left);
                }
                else if (relativeAngleZ >= 135 && relativeAngleZ <= 215)
                {
                    PlayDAnim(GameConstVal.Run_back);
                }
                else
                {
                    PlayDAnim(GameConstVal.Run_right);
                }
            }
            else
            {
                m_Player.angle = -1f;
                PlayDAnim(GameConstVal.Idle);
            }
        }
Exemple #20
0
 public void Move(float sx, float sy)
 {
     // 有载具 就先 走载具
     if (!m_Carrier.HasCarrier())
     {
         if (m_InNormalPassType)
         {
             Vector2 velocity = new Vector2(sx, sy);
             m_Player.SetSpeed(velocity.normalized * m_Player.GetSpeed() * BaseScene.TimeScale);
             CalcCurAnim(sx, sy);
             MoveImp(sx, sy);
         }
         else
         {
             sy = 0;
             Vector2 velocity = new Vector2(sx, sy);
             m_Player.SetSpeed(velocity.normalized * m_Player.GetSpeed() * BaseScene.TimeScale);
             CalcCurAnim(0, 1);
             MoveImp(0, 1);
         }
     }
     else
     {
         if (m_InNormalPassType)
         {
             m_Carrier.Move(sx, sy);
             MoveImp(sx, sy);
         }
         else
         {
             sy = Mathf.Abs(sx) * 3;
             m_Carrier.Move(sx, 0);
             if (sx == 0 && sy == 0)
             {
                 sy = 1;
             }
             float angleZ = EZMath.SignedAngleBetween(new Vector3(sx, sy, 0), Vector3.up);
             CalcAngles(angleZ);
         }
     }
 }
Exemple #21
0
 private void FreshBillboardText()
 {
     if (m_AdHeartWatchTimes >= m_AdHeartTotalTimes)
     {
         m_AdCountDown.text.text         = string.Empty;
         m_AdIconBtn.button.interactable = true;
         return;
     }
     if (!m_NpcMgr.GetHasHeartAd())
     {
         double dtTime   = m_NpcMgr.GetAdDtTime() / 1000;
         int    realLeft = 360 - (int)dtTime;
         m_AdCountDown.text.text         = EZMath.FormateTimeMMSS(realLeft);
         m_AdIconBtn.button.interactable = false;
     }
     else
     {
         m_AdCountDown.text.text         = string.Empty;
         m_AdIconBtn.button.interactable = true;
     }
 }
Exemple #22
0
        private void FaceToEnemyImp()
        {
            if (m_LockGameEnemy)
            {
                float angleZ = EZMath.SignedAngleBetween(m_LockGameEnemy.transform.position - m_RotateRoleNode.position, Vector3.up);

                CalcAngles(angleZ);
                if (!m_Gun.enabled)
                {
                    m_Gun.enabled = true;
                }
            }
            else
            {
                if (m_Gun.enabled)
                {
                    m_Gun.enabled = false;
                }
                PlayTurretAnim(GameConstVal.Idle_Deploy);
            }
        }
Exemple #23
0
        public void Update()
        {
            float   angleZ1      = m_LockTransform.localEulerAngles.z * Mathf.Deg2Rad;
            float   cosVal       = (float)Math.Cos(angleZ1);
            float   sinVal       = (float)Math.Sin(angleZ1);
            Vector3 newOffset    = new Vector3(cosVal * m_Offset.x - sinVal * m_Offset.y, sinVal * m_Offset.x + cosVal * m_Offset.y, 0);
            Vector3 vector       = (m_LockTransform.position + newOffset - m_OwnnerTsf.position);
            float   sqrMagnitude = vector.sqrMagnitude;

            if (sqrMagnitude > m_SqrBreakDis)
            {
                if (m_BreakCallBack != null)
                {
                    m_BreakCallBack();
                    return;
                }
            }
            if (m_RotateState)
            {
                float angleZ = EZMath.SignedAngleBetween(vector, Vector3.up);
                m_OwnnerTsf.localEulerAngles = new Vector3(0, 0, angleZ);
            }
            if (m_FollowState)
            {
                if (sqrMagnitude > m_SqrMaxRadio)
                {
                    m_Pet.SetSpeed(vector.normalized * m_FollowSpeed);
                }
                else if (sqrMagnitude < m_SqrMinRadio)
                {
                    m_Pet.SetSpeed(-vector.normalized * m_FollowSpeed);
                }
                else
                {
                    m_Pet.SetSpeed(Vector3.zero);
                }
            }
        }
Exemple #24
0
        void Update()
        {
            float dtTime = BaseScene.GetDtTime();

            m_CurTime = m_CurTime + dtTime;
            if (dtTime == 0)
            {
                m_Monster.SetAbsSpeed(Vector2.zero);
                return;
            }
            if (m_StartAct)
            {
                DashToMainPlayer();
            }
            else
            {
                if (m_CurTime >= DtTime)
                {
                    if (m_Monster.TriggerSecondAct())
                    {
                        m_CurTime = 0;
                        m_Monster.SetAbsSpeed(Vector2.zero);
                        m_Monster.PlayAnim(GameConstVal.Skill01);
                        m_StartAct         = true;
                        m_NeedCalcSpeed    = true;
                        m_RightBody2d.mass = 999999999;
                        if (m_NeedCalcSpeed)
                        {
                            m_NeedCalcSpeed            = false;
                            m_SpeedVec                 = m_Player.transform.position - transform.position;
                            m_SpeedVec                 = m_SpeedVec.normalized;
                            transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(m_SpeedVec, Vector3.up));
                            InstanceEffect();
                        }
                    }
                }
            }
        }
Exemple #25
0
        public void MoveImp(float sx, float sy)
        {
            // Move the character

            if (m_LockGameEnemy == null)
            {
                if (sx != 0 || sy != 0)
                {
                    float angleZ = EZMath.SignedAngleBetween(new Vector3(sx, sy, 0), Vector3.up);
                    CalcAngles(angleZ);
                }
                if (!m_Carrier.HasCarrier())
                {
                    PlayUAnim(GameConstVal.Idle);
                }
            }
            else
            {
                if (!m_Carrier.HasCarrier())
                {
                }
            }
        }
Exemple #26
0
 private void CheckEnd()
 {
     if (m_CurTime < m_FaceTime)
     {
         Vector3 faceVec = m_Player.transform.position - transform.position;
         transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(faceVec, Vector3.up));
     }
     if (m_CurTime > m_PauseStartTime && m_CurTime < m_PauseEndTime)
     {
         m_Monster.SetAnimFloat(GameConstVal.SpeedSymbolStr, 0.0f);
     }
     else
     {
         m_Monster.SetAnimFloat(GameConstVal.SpeedSymbolStr, 1.0f);
     }
     if (m_CurTime > m_SkillTime)
     {
         m_Monster.PlayAnim(GameConstVal.Run);
         m_CurTime  = 0;
         m_StartAct = false;
         m_Monster.EndFirstAct();
     }
 }
Exemple #27
0
 protected void UpdatePointArrow(bool visible)
 {
     if (!m_InNormalPass)
     {
         return;
     }
     if (m_TaskState == TaskState.Begin)
     {
         if (visible)
         {
             if (m_TargetTsf != null && m_PlayerTsf != null)
             {
                 Vector3 pointVec = m_TargetTsf.position - m_PlayerTsf.position;
                 pointVec.z = 0;
                 float newLength = pointVec.magnitude;
                 if (newLength < 500)
                 {
                     float angle = EZMath.SignedAngleBetween(pointVec, Vector3.up);
                     Global.gApp.gMsgDispatcher.Broadcast <float, string, FightTaskUiType>(MsgIds.PointArrowAngle, angle, ((int)pointVec.magnitude).ToString() + "m", m_FightArrowType);
                 }
                 else
                 {
                     Global.gApp.gMsgDispatcher.Broadcast <float, string, FightTaskUiType>(MsgIds.PointArrowAngle, -100, GameConstVal.EmepyStr, m_FightArrowType);
                 }
             }
             else
             {
                 Global.gApp.gMsgDispatcher.Broadcast <float, string, FightTaskUiType>(MsgIds.PointArrowAngle, -100, GameConstVal.EmepyStr, m_FightArrowType);
             }
         }
         else
         {
             Global.gApp.gMsgDispatcher.Broadcast <float, string, FightTaskUiType>(MsgIds.PointArrowAngle, -100, GameConstVal.EmepyStr, m_FightArrowType);
         }
     }
 }
Exemple #28
0
 void Update()
 {
     if (m_StartAct)
     {
         BitePlayer();
     }
     else
     {
         m_CurTime += GetActDtTime();
         if (m_CurTime >= DtTime)
         {
             Vector3 speedVec = m_Player.transform.position - transform.position;
             if (speedVec.sqrMagnitude < m_SqrTriggerRange && m_Monster.TriggerFirstAct())
             {
                 m_CurTime = 0;
                 m_Monster.SetSpeed(Vector2.zero);
                 m_Monster.PlayAnim(GameConstVal.Skill01);
                 m_StartAct = true;
                 transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(speedVec, Vector3.up));
                 m_LockSpeed = speedVec.normalized;
             }
         }
     }
 }
        private void OnAd()
        {
            //InfoCLogUtil.instance.SendClickLog(ClickEnum.NO_ENERGY_AD);
            if (Global.gApp.gSystemMgr.GetMiscMgr().adEnegyTimes >= m_AdAddEnergyTimesLimit)
            {
                Global.gApp.gMsgDispatcher.Broadcast <int>(MsgIds.ShowGameTipsByID, 3044);
                return;
            }
            double leftMills = Global.gApp.gSystemMgr.GetMiscMgr().lastAdEnegyMills + m_AdAddEnergyCD * 1000 - DateTimeUtil.GetMills(DateTime.Now);

            if (leftMills > 0)
            {
                int leftSecs = (int)Math.Round(leftMills / 1000);
                Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 3059, EZMath.FormateTime(leftSecs));
                return;
            }
            //调用广告sdk
            AdManager.instance.ShowRewardVedio(CompleteAd, AdShowSceneType.GET_ENERGY, 0, 0, 0);
            //CompleteAd(true);
        }
Exemple #30
0
        private void MoveToRole()
        {
            Transform targetNode = GetTargetNode();

            if (targetNode != null)
            {
                Vector3 posStart  = transform.position;
                Vector3 targetPos = targetNode.position;
                Vector2 velocity  = new Vector2(targetPos.x - posStart.x, targetPos.y - posStart.y);
                // 僵尸是否愚蠢
                if (!m_AutomaticPath || (m_AutomaticPath && !m_AiPath.enabled))
                {
                    if (velocity.sqrMagnitude > 0.25f)
                    {
                        Vector2 velocity2 = velocity.normalized * m_BaseSpeed * m_HitSpeedScale;
                        m_Monster.SetSpeed(velocity2 * BaseScene.TimeScale);
                        transform.localEulerAngles = new Vector3(0, 0, EZMath.SignedAngleBetween(targetPos - posStart, Vector3.up));
                    }
                    else
                    {
                        m_Monster.SetSpeed(Vector2.zero);
                    }
                }
                else
                {
                    // 是否在外面,并根据是否在屏幕外做优化
                    if (m_Monster.InShadowView)
                    {
                        m_collider.isTrigger = false;
                        if (!isNoUsePath)
                        {
                            m_AiPath.repathRate = 0.2f;
                        }
                        m_rvoController.agentTimeHorizon    = 0.4f; // 检测代理碰撞的时间间隔
                        m_rvoController.obstacleTimeHorizon = 0.6f; // 检测其他障碍碰撞的时间间隔
                        m_rvoController.maxNeighbours       = 2;
                    }
                    else
                    {
                        m_collider.isTrigger = true;

                        if (!isNoUsePath)
                        {
                            m_AiPath.repathRate = 0.5f;
                        }
                        m_rvoController.agentTimeHorizon    = 1f; // 检测代理碰撞的时间间隔
                        m_rvoController.obstacleTimeHorizon = 1f; // 检测其他障碍碰撞的时间间隔
                        m_rvoController.maxNeighbours       = 2;
                    }


                    // 插件的目标
                    if (m_seeker.IsDone())
                    {
                        m_AiPath.destination = targetNode.position;
                    }

                    if (velocity.sqrMagnitude > 0.25f)
                    {
                        //Vector2 velocity2 = velocity.normalized * m_BaseSpeed * m_HitSpeedScale;
                        float velocity2Val = m_BaseSpeed * m_HitSpeedScale;
                        // 修改为插件速度
                        float speedVal = velocity2Val * BaseScene.TimeScale;
                        float newSpeed = 1;
                        if (m_Monster.m_AiBuffMgr != null)
                        {
                            newSpeed += m_Monster.m_AiBuffMgr.GetIncMoveSpeed();
                        }
                        speedVal *= newSpeed;

                        m_AiPath.maxSpeed = speedVal;
                    }
                    else
                    {
                        //修改为插件速度
                        m_AiPath.maxSpeed = 0;
                    }
                }
            }
        }