Esempio n. 1
0
    protected override void StartExecute(bool isFastNav)
    {
        EntitySelf entSelf = EntityWorld.Instance.EntSelf;

        if (entSelf != null && entSelf.Actor)
        {
            if (this.mCurGoods != null)
            {
                Vector3 vector  = new Vector3((float)this.mCurGoods.position.get_Item(0), (float)this.mCurGoods.position.get_Item(1), (float)this.mCurGoods.position.get_Item(2)) * 0.01f;
                Vector3 vector2 = new Vector3((float)this.mCurGoods.flyPosition.get_Item(0), (float)this.mCurGoods.flyPosition.get_Item(1), (float)this.mCurGoods.flyPosition.get_Item(2)) * 0.01f;
                if (this.mCurGoods.scene == MySceneManager.Instance.CurSceneID)
                {
                    Vector3 vector3 = Vector3.get_zero();
                    if (this.mCurGoods.face.get_Count() >= 3)
                    {
                        vector3 = new Vector3((float)this.mCurGoods.face.get_Item(0), (float)this.mCurGoods.face.get_Item(1), (float)this.mCurGoods.face.get_Item(2)) * 0.01f;
                    }
                    Quaternion quaternion  = Quaternion.Euler(vector3.x, vector3.y, vector3.z);
                    Vector3    vector4     = quaternion * Vector3.get_forward() * 2f;
                    float      distanceNoY = XUtility.GetDistanceNoY(entSelf.Actor.FixTransform.get_position(), vector);
                    if (isFastNav)
                    {
                        this.FastCollectGoods(distanceNoY, vector, vector2);
                    }
                    else
                    {
                        this.NormalCollectGoods(distanceNoY, vector);
                    }
                }
                else if (isFastNav)
                {
                    base.IsAutoNav = true;
                    MainTaskManager.Instance.DelaySendFlyShoe(true, this.mCurGoods.scene, vector2);
                }
                else
                {
                    base.IsAutoNav = false;
                    TownCountdownUI townCountdownUI = UIManagerControl.Instance.OpenUI("TownCountdownUI", null, false, UIType.NonPush) as TownCountdownUI;
                    townCountdownUI.StartTransmit(base.Task.taskId, this.mCurGoods.scene);
                }
            }
            else
            {
                Debug.LogFormat("<color=red>Error:</color>采集任务[{0}]数据已被销毁!!!", new object[]
                {
                    base.Task.taskId
                });
            }
        }
    }
Esempio n. 2
0
    protected void PlayCollect(CaiJiPeiZhi goods, string ActionName)
    {
        if (goods == null)
        {
            return;
        }
        this.IsCollecting = true;
        EntityWorld.Instance.EntSelf.Actor.GetComponentInChildren <Animator>().Play(ActionName);
        if (MainTaskManager.Instance.GoodsModels.ContainsKey(goods.id))
        {
            MainTaskManager.Instance.GoodsModels[goods.id] = 1;
            EventDispatcher.Broadcast(EventNames.StartCollecting);
        }
        TownCountdownUI townCountdownUI = UIManagerControl.Instance.OpenUI("TownCountdownUI", null, false, UIType.NonPush) as TownCountdownUI;

        townCountdownUI.StartCountdown((float)goods.time / 1000f, GameDataUtils.GetChineseContent(goods.tips, false), base.Task.taskId, new Action(this.OnFinishCollect), new Action <bool>(this.OnStopCollect));
    }