예제 #1
0
    /// <summary>
    /// This controls the order of events for the UFO spawner. enables and disables the tracktor beam mesh and plays and stops the animation for the tracktor beam.
    /// </summary>
    /// <returns></returns>
    IEnumerator UfoSpawn()
    {
        ufo.Pause();
        yield return(new WaitForSeconds(.5f));

        tractorBeam.enabled = true;
        tracktorBeamAnimator.SetBool("isUp", false);
        //Spawn Enemy
        spawn.SpawnEnemy();
        yield return(new WaitForSeconds(1f));

        tracktorBeamAnimator.SetBool("isUp", true);
        tracktorBeamAnimator.SetBool("isUp", false);
        //Spawn Enemy
        spawn.SpawnEnemy();
        yield return(new WaitForSeconds(1f));

        tracktorBeamAnimator.SetBool("isUp", true);
        yield return(new WaitForSeconds(1f));

        tracktorBeamAnimator.SetBool("isUp", false);
        //Spawn Enemy
        spawn.SpawnEnemy();
        yield return(new WaitForSeconds(1f));

        tracktorBeamAnimator.SetBool("isUp", true);
        tractorBeam.enabled = false;
        yield return(new WaitForSeconds(.5f));

        ufo.Resume();
    }
예제 #2
0
 void Start()
 {
     move = GetComponent <splineMove>();
     move.StartMove();
     move.Pause();
     progress = 0f;
     _speed   = speed;
 }
예제 #3
0
    IEnumerator SplinePause()
    {
        script.Pause();
        yield return(new WaitForSeconds(8f));

        script.Resume();
        isAttacking = false;
    }
예제 #4
0
 //get references at start
 //initialize movement but don't start it yet
 void Start()
 {
     animator = GetComponent <Animator>();
     move     = GetComponent <splineMove>();
     move.StartMove();
     move.Pause();
     progress = 0f;
 }
예제 #5
0
    public void OnFreeze(AssetBundle ab, bool bFreeze)
    {
        if (bFreeze)
        {
            Vector3    postion  = transform.position;
            Quaternion rotation = transform.rotation;
            Vector3    scale    = transform.localScale;
            transform.position   = Vector3.zero;
            transform.rotation   = Quaternion.Euler(Vector3.zero);
            transform.localScale = Vector3.one;

            Vector3 center = Vector3.zero;
            foreach (Renderer child in m_Renderers)
            {
                center += child.bounds.center;
            }
            center /= m_Renderers.Length;
            Bounds bounds = new Bounds(center, Vector3.zero);
            foreach (Renderer child in m_Renderers)
            {
                bounds.Encapsulate(child.bounds);
            }

            GameObject obj = (GameObject)ab.LoadAsset("Flshing_Bingdong");
            obj = Instantiate(obj);
            obj.transform.SetParent(transform, false);
            obj.transform.localPosition = bounds.center - transform.position;
            obj.transform.localScale    = bounds.size;
            obj.name  = "Bing";
            obj.layer = gameObject.layer;

            transform.position   = postion;
            transform.rotation   = rotation;
            transform.localScale = scale;

            if (m_SplineMove != null)
            {
                m_SplineMove.Pause();
            }
        }
        else
        {
            Transform tfm = transform.Find("Bing");
            if (tfm != null)
            {
                Destroy(tfm.gameObject);
            }

            if (m_SplineMove != null)
            {
                m_SplineMove.Resume();
            }
        }
    }
예제 #6
0
    void Start()
    {
        _splineMove = GetComponent <splineMove>();

        _splineMove.onStart    = true;
        _splineMove.moveToPath = true;
        _splineMove.loopType   = splineMove.LoopType.pingPong;
        _splineMove.pathType   = PathType.Linear;

        _splineMove.speed = speed;
        if (lockRotation)
        {
            _splineMove.lockRotation = AxisConstraint.Y;
        }

        _splineMove.events[0]
        .AddListener(() => _splineMove.Pause(waitTime));
        _splineMove.events[_splineMove.events.Count - 1]
        .AddListener(() => _splineMove.Pause(waitTime));
    }
예제 #7
0
    Fishing_Fish[] CreatFish(byte fishTypeId, FishingPathData pd, Transform parent, PathManager pm, uint fishId, int count, float passTime, byte group, byte index)
    {
        if (!Fishing_Data.GetInstance().m_FishData.ContainsKey(fishTypeId))
        {
            DebugLog.LogError("fish:" + fishTypeId + " data is error!!");
            return(null);
        }

        FishingFishData fd     = Fishing_Data.GetInstance().m_FishData[fishTypeId];
        GameObject      prefab = (GameObject)m_GameBase.FishingAssetBundle.LoadAsset(fd.m_szFish);

        int arrayCount = pd.m_Offsets.Count > 0 ? pd.m_Offsets.Count : 1;

        Debug.Assert(count != 0 && count <= arrayCount, "create fish count wrong!!");

        Fishing_Fish[] fishs = new Fishing_Fish[count];
        for (uint j = 0; j < count; j++)
        {
            GameObject go = (GameObject)GameMain.instantiate(prefab);
            go.transform.SetParent(parent, false);
            splineMove sm = go.AddComponent <splineMove>();
            sm.local            = true;
            sm.lookAhead        = 0.01f;
            sm.forwardDir       = Vector3.right;
            sm.pathMode         = PathMode.Ignore;
            sm.offset           = index < pd.m_Offsets.Count ? pd.m_Offsets[index] : Vector3.zero;
            sm.waypointRotation = (fd.m_nRotType == 1) ? splineMove.RotationType.all : splineMove.RotationType.none;
            if (m_GameBase.IsMirror())
            {
                sm.eulerAngles = (fd.m_nRotType == 1) ? new Vector3(180f, 0f, 0f) : new Vector3(0f, 0f, 180f);
            }
            else
            {
                sm.eulerAngles = Vector3.zero;
            }
            sm.speed    = fd.m_GroupSpeed[group];
            sm.loopType = pd.m_bLoop ? splineMove.LoopType.loop : splineMove.LoopType.none;
            sm.SetPath(pm);
            sm.GoTo(GetPathPassTime(passTime, sm, pd));

            if (FishPause)
            {
                sm.Pause();
            }

            Fishing_Fish fish = go.transform.Find("skin").gameObject.AddComponent <Fishing_Fish>();
            fish.Init(m_GameBase, sm, fishId + j, fishTypeId);
            fish.OnDeath += RemoveFish;
            fishs[j]      = fish;
            m_FishDict.Add(fish.m_nOnlyId, fish);
        }
        return(fishs);
    }
예제 #8
0
    //get references
    void Start()
    {
        move = GetComponent <splineMove>();
        if (!move)
        {
            Debug.LogWarning(gameObject.name + " missing movement script!");
            return;
        }

        //set speed to an arbitrary small value
        //otherwise the tween can't be initialized
        move.speed = 0.01f;
        //initialize movement but don't start it yet
        move.StartMove();
        move.Pause();
        move.speed = 0f;
    }
예제 #9
0
    void PathManagerSegmentComplete()
    {
        //Output message to the console

        if ((!reversed && _currentPathManagerEdge.NextEdge == null) || (reversed && _currentPathManagerEdge.PreviousEdge == null))
        {
            reversed      = !reversed;
            _currentSpeed = 0.01f;
            _accelerating = true;

            if (reversed)
            {
                _tradeRoute.BeginUnloadingOil();
            }
            else
            {
                _tradeRoute.BeginLoadingOil();
            }

            _isPaused = true;
            _currentSplineMove.Pause();
            return;
        }
        else
        {
            if (!reversed)
            {
                _currentPathManagerEdge = _currentPathManagerEdge.NextEdge;
            }
            else
            {
                _currentPathManagerEdge = _currentPathManagerEdge.PreviousEdge;
            }
        }
        MoveToEndOfPathManagerSegment();
    }
예제 #10
0
 //get references at start
 //initialize movement but don't start it yet
 void Start()
 {
     myMove = gameObject.GetComponent <splineMove>();
     myMove.StartMove();
     myMove.Pause();
 }
예제 #11
0
 public void SplinePause()
 {
     Debug.Log("PauseAtWayPoints");
     spline.Pause(1f);
 }
예제 #12
0
    float GetPathPassTime(float passTime, splineMove sm, FishingPathData pd)
    {
        if (pd.m_ChangePoints.Count == 0)
        {
            return(passTime);
        }

        float       value;
        float       speed      = sm.speed;
        float       countTime  = passTime;
        List <byte> changeList = new List <byte>(pd.m_ChangePoints.Keys);

        if (passTime > 0f)
        {
            sm.tween.ForceInit();

            TweenerCore <Vector3, Path, PathOptions> tweenPath = sm.tween as TweenerCore <Vector3, Path, PathOptions>;
            float time = 0f;
            countTime = 0f;
            float curSpeed = speed;
            for (byte i = 0; i < sm.pathContainer.GetWaypointCount(); i++)
            {
                value      = tweenPath.changeValue.wpLengths[i] / curSpeed;
                time      += value;
                countTime += value;

                if (passTime <= time)
                {
                    countTime -= (time - passTime);
                    break;
                }

                if (pd.m_ChangePoints.ContainsKey(i))
                {
                    changeList.Remove(i);

                    if (i >= sm.events.Count)
                    {
                        DebugLog.LogWarning("Error: fish point count(" + sm.events.Count + ") out path(" + pd.m_szPath + ") change config!!");
                        break;
                    }

                    value = pd.m_ChangePoints[i];
                    if (value > 0f)
                    {
                        sm.events[i].AddListener(() => sm.ChangeSpeed(value * speed));
                        curSpeed = speed * value;
                    }
                    else
                    {
                        time -= value;
                        if (passTime <= time)
                        {
                            sm.events[i].AddListener(() => sm.Pause(time - passTime));
                            break;
                        }
                    }
                }
            }
        }

        foreach (byte i in changeList)
        {
            if (i >= sm.events.Count)
            {
                DebugLog.LogWarning("Error: fish point count(" + sm.events.Count + ") out path(" + pd.m_szPath + ") change config!!");
                break;
            }
            value = pd.m_ChangePoints[i];
            if (value > 0f)
            {
                sm.events[i].AddListener(() => sm.ChangeSpeed(value * speed));
            }
            else
            {
                sm.events[i].AddListener(() => sm.Pause(-value));
            }
        }

        return(countTime);
    }