public void InitItem() { splineMove = GetComponent <splineMove>(); if (null == splineMove) { splineMove = gameObject.AddComponent <splineMove>(); } boxcollider = GetComponent <BoxCollider2D>(); foodImg = GetComponent <Image>(); splineMove.pathContainer = GameCtrl._Ins.mapCurve; splineMove.speed = GameCtrl._Ins.GetCurrLevelData().Movespeed; splineMove.pathMode = DG.Tweening.PathMode.TopDown2D; splineMove.loopType = splineMove.LoopType.loop; //Debug.Log($"{transform.name} = {transform.position},vector[0]:{splineMove.pathContainer.GetPathPoints()[0]}"); //transform.position = splineMove.pathContainer.GetPathPoints()[0]; //Debug.Log($"{transform.name} = {transform.position},vector[0]:{splineMove.pathContainer.GetPathPoints()[0]}"); splineMove.StartMove(); // 事件必须在 startMove() 调用了在添加 //Debug.Log($"曲线事件长度 = {splineMove.events.Count}"); UnityEvent myEvent = splineMove.events[splineMove.events.Count - 1]; myEvent.RemoveAllListeners(); myEvent.AddListener(() => { //Debug.Log($"到达曲线终点,pointIndex = {splineMove.events.Count - 1}"); ResetItem(); GameCtrl._Ins.EC.OnFoodArriveEndPoint?.Invoke(this); }); }
public void InitItem() { splineMove.pathContainer = GameCtrl._Ins.mapCurve; //splineMove.speed = GameCtrl._Ins.GetCurrLevelData().Movespeed; splineMove.StartMove(); // 事件必须在 startMove() 调用了在添加 //Debug.Log($"曲线事件长度 = {splineMove.events.Count}"); UnityEvent myEvent = splineMove.events[splineMove.events.Count - 1]; myEvent.RemoveAllListeners(); myEvent.AddListener(() => { //Debug.Log($"履带到达曲线终点,pointIndex = {splineMove.events.Count - 1}"); ResetItem(); //GameCtrl._Ins.EC.OnFoodArriveEndPoint?.Invoke(this); }); }
public void Reset() { ////transform.localPosition = _storagePosition; //Vector3 testWayPoint = mWayPointList.GetVector3AtIndex (1); //transform.localPosition = testWayPoint; ////transform.localPosition = _startPosition; //mCurrentWayPoint = 0; //mOnEndPoint = false; spline = GetComponent <splineMove> (); float speed = spline.speed; Debug.Log("speed = " + speed); spline.StartMove(); //spline.Stop (); //_State = eState.GetWayPoint; }
void Start() { move = GetComponent <splineMove>(); move.StartMove(); move.Pause(); progress = 0f; _speed = speed; }
//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; }
// public methods are done here public void InitCharacter(PathManager path) { //set path agent.pathContainer = path; //set events UnityEvent start = new UnityEvent(); UnityEvent end = new UnityEvent(); start.AddListener(OnPathStart); end.AddListener(OnPathEnd); agent.events.Clear(); agent.events.Add(start); agent.events.Add(new UnityEvent()); agent.events.Add(end); // move character agent.StartMove(); }
public void PerformAttackPath(splineMove pathMover) { //GameEvents.current.AnimationStart(); pathMover.StartMove(); spline.currentPoint = 0; doCheckFinalCellEnemyAttack = true; isMoving = true; combatController.ListOfcells[GetComponent <Mover>().GetGridPos()].isOccupied = false; GetComponent <AnimationHandler>().Run(); savedWing = GetComponent <EnemyTarget>().wing; }
// Update is called once per frame void Update() { if (device.GetHairTrigger()) { RaycastHit hit; if (Physics.Raycast(controller.transform.position, controller.transform.forward, out hit)) { if (hit.collider.tag == "Start") { t_script.color = Color.green; isHit = true; } else { t_script.color = new Color32(0, 143, 255, 255); isHit = false; } } } else { t_script.color = new Color32(0, 143, 255, 255);; } if (device.GetHairTriggerUp() && isHit && !audioManagerScript.isStartLocked) { _splineMove.StartMove(); _splineMoveFront.startPoint = 3; _splineMoveFront.StartMove(); _splineMoveBack.StartMove(); _splineMoveSide.startPoint = 2; _splineMoveSide.StartMove(); t_script.color = Color.green; animLogo.SetTrigger("startMove"); Destroy(logo, 3f); timerScript.isCountDownStart = true; pHealthScript.isStart = true; } }
//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; }
public void ToSaturn() { if (!_moving) { _ss.pathContainer = saturnpathContainer; _ss.speed = 500; _moving = true; _ss.StartMove(); whichplant = 1; turnOffBtn(); ToWhichGameScene = 2; //with planeButtonVScrossSceneCarrier } }
//get references at start //initialize movement but don't start it yet void Start() { myMove = gameObject.GetComponent <splineMove>(); myMove.StartMove(); myMove.Pause(); }