Пример #1
0
 private void FixedUpdate()
 {
     if (OnlyTracing == true)
     {
         transform.position = Vector2.MoveTowards(transform.position, GlobalVariable.GetPlayer().transform.position, DistanceDelta * Time.fixedDeltaTime);
     }
     else
     {
         if (m_bDash == false)
         {
             float fDistancePlayer = Vector2.Distance(transform.position, GlobalVariable.GetPlayer().transform.position);
             if (fDistancePlayer <= DistanceDashPlayer)
             {
                 m_bDash                   = true;
                 m_movingObj.enabled       = false;
                 m_mainParticle.startColor = new ParticleSystem.MinMaxGradient(ChangeStateColorEnd, ChangeStateColorStart);
             }
         }
         else
         {
             float fDistanceBreakAway = Vector2.Distance(transform.position, GlobalVariable.GetPlayer().transform.position);
             if (fDistanceBreakAway >= PlayerBreakAwayDistance)
             {
                 m_bDash                   = false;
                 m_movingObj.enabled       = true;
                 m_mainParticle.startColor = new ParticleSystem.MinMaxGradient(BeginColorStartMax, BeginColorStartMin);
             }
             else
             {
                 transform.position = Vector2.MoveTowards(transform.position, GlobalVariable.GetPlayer().transform.position, DistanceDelta * Time.fixedDeltaTime);
             }
         }
     }
 }
Пример #2
0
 // Start is called before the first frame update
 protected virtual void Start()
 {
     m_transPlayer = GlobalVariable.GetPlayer().transform;
     if (m_transPlayer == null)
     {
         Debug.Assert(false);
     }
 }
Пример #3
0
 // Start is called before the first frame update
 void Start()
 {
     if (GlobalVariable.GetPlayer() != null)
     {
         m_transPlayer = GlobalVariable.GetPlayer().transform;
     }
     _processFlipEnemy(true);
     m_bValid = true;
 }
Пример #4
0
    private void Start()
    {
        if (StrawberryMgr.instance == null)
        {
            Debug.Assert(false, string.Format("场景缺少assets\\prefabs\\world\\StrawberryMgr物件,请摆放上去"));
        }
        m_nIndexOfStrawberry = StrawberryMgr.instance.GetCurrentIndex();
        if (StrawberryMgr.instance.IsIndexHasBeenTake(m_nIndexOfStrawberry) == true)
        {
            Destroy(gameObject);
        }
        else if (StrawberryMgr.instance.IsSceneStrawberryInit(m_nIndexOfStrawberry) == true)
        {
            //CheckPointTotalManager.instance.DescreaseAndUpdate();
            Destroy(gameObject);
        }
        else
        {
            StrawberryMgr.instance.InitStrawberry(m_nIndexOfStrawberry);
            transform.SetParent(null);
            DontDestroyOnLoad(gameObject);
            if (StrawBerryFolloingTime == 0.0f)
            {
                StrawBerryFolloingTime = 3.0f;
            }
            m_vecOriginalPos = transform.position;
            sr           = GetComponent <SpriteRenderer>();
            worldManager = GameObject.FindGameObjectWithTag("WorldManager").GetComponent <CheckPointTotalManager>();
            m_playerCtrl = GlobalVariable.GetPlayer();
            GlobalVariable.RegisteSetPlayerEvent(_setPlayer);

            if (m_playerCtrl != null)
            {
                m_playerCtrl.RegisteDieAction(_playerDie);
            }
            else
            {
                Debug.Assert(false);
            }
            if (FollowingSpeed == 0.0f)
            {
                FollowingSpeed = 3.0f;
            }
        }
    }
Пример #5
0
 public override TaskStatus OnUpdate()
 {
     if (PlayerTransform.Value == null)
     {
         PlayerTransform.Value = GlobalVariable.GetPlayer().transform;
         if (PlayerTransform.Value != null)
         {
             return(TaskStatus.Success);
         }
         else
         {
             return(TaskStatus.Failure);
         }
     }
     else
     {
         return(TaskStatus.Success);
     }
 }