public Config(UnitsControlPlus main) { Main = main; Screen = new Vector2(Drawing.Width - 160, Drawing.Height); Factory = MenuFactory.CreateWithTexture("UnitsControlPlus", "unitscontrolplus"); Factory.Target.SetFontColor(Color.Aqua); ControllableMenu = Factory.Menu("Controllable Heroes"); ControlHeroesItem = ControllableMenu.Item("Control Heroes", false); var DrawingMenu = Factory.Menu("Drawing"); TextItem = DrawingMenu.Item("Text", true); TextXItem = DrawingMenu.Item("X", new Slider(0, 0, (int)Screen.X - 60)); TextYItem = DrawingMenu.Item("Y", new Slider(0, 0, (int)Screen.Y - 200)); RadiusTargetUnitsItem = Factory.Item("Radius from Target to Units", new Slider(5000, 0, 10000)); RadiusTargetUnitsItem.Item.SetTooltip("Activation for Units from Target Radius"); PressKeyItem = Factory.Item("Press Key", new KeyBind('0')); PressTargetItem = Factory.Item("Press Target", new StringList("Lock", "Default")); ToggleKeyItem = Factory.Item("Toggle Key", new KeyBind('0', KeyBindType.Toggle, false)); ChangeTargetItem = Factory.Item("Change Target Key", new KeyBind('0')); FollowKeyItem = Factory.Item("Follow Key", new KeyBind('0', KeyBindType.Toggle, false)); ControlWithoutTargetItem = Factory.Item("Control Without Target in Radius", new Slider(5000, 0, 10000)); ControlWithoutTargetItem.Item.SetTooltip("Control all Units in this radius, if there is no Target"); WithoutTargetItem = Factory.Item("Without Target", new StringList("Move Mouse Position", "Follow on Hero", "None")); Mode = new Mode(this); FollowMode = new FollowMode(this); HeroControl = new HeroControl(this); UpdateMode = new UpdateMode(this); Renderer = new Renderer(this); }
/// <summary> /// 相机移动方法 sxj /// </summary> /// <param name='Mode'> /// Mode. /// </param> /// <param name='TargetVector'> /// Target vector. /// </param>/ public void CameraMove(FollowMode Mode, Vector3 TargetVector) { if (GameCenter.instance.isDevelopmentPattern) { Mode = FollowMode.Nomal; } switch (Mode) { case FollowMode.Nomal: this.transform.position = ActorMoveFSM.CameraLineCast(TargetVector); break; case FollowMode.Smooth: #region 调试 //Vector3 lastPos = TargetVector; //if(movecount%2==0) //{ // Debug.DrawLine(lastPos,transform.position,Color.green,8f,true); // Debug.DrawLine(lastPos,lastPos + new Vector3(0f,0.2f,0f),Color.green,8f,true); //} //else //{ // Debug.DrawLine(lastPos,transform.position,Color.white,8f,true); // Debug.DrawLine(lastPos,lastPos + new Vector3(0f,0.2f,0f),Color.red,8f,true); //} //movecount++; #endregion //Debug.DrawLine(TargetVector,TargetVector + new Vector3(0f,0.5f,0f),Color.yellow,8f,true); TargetVector = ActorMoveFSM.CameraLineCast(TargetVector); this.transform.position = Vector3.SmoothDamp(transform.position, TargetVector, ref currentVelocity, 0.1f); break; } }
protected override bool Reason(AIBehaviors fsm) { Transform sightedPlayer; float closestPlayerDistance = Mathf.Infinity; sightedPlayer = fsm.GetClosestPlayerWithinSight(out closestPlayerDistance, false); if ( sightedPlayer != null ) { float sqrStartChaseDistance = startChaseDistance * startChaseDistance; float sqrBreakChaseDistance = breakChaseDistance * breakChaseDistance; if ( closestPlayerDistance > sqrBreakChaseDistance ) { curFollowMode = FollowMode.Normal; } else if ( closestPlayerDistance < sqrStartChaseDistance ) { curFollowMode = FollowMode.Chase; } lastSightedPlayer = sightedPlayer; lastSightedPlayerLocation = lastSightedPlayer.position; } else lastSightedPlayer = null; return true; }
void OnGUI() { DGUtils.BeginGUI(); followMode = (FollowMode)GUILayout.Toolbar((int)followMode, followModeList); DGUtils.EndGUI(); }
public void ChangeMode(FollowMode mode, GameObject target) { if (_target == null) { _mode = FollowMode.NON; return; } _mode = mode; }
public FollowAvatarAndTargetState(MainCameraFollowState followState) : base(followState) { this._feasibleAngles = new List <float>(4); this._motionAngleInfos = new List <MotionAngleInfo>(4); this._speedForOneCircle = 3000f; this._accelerationSolvingWallHit = 7000f; this._minSpeedSolvingWallHit = 200f; this.DELTA_TIME_PER_FRAME = 0.016f; this._mode = FollowMode.TargetMode; base.maskedShortStates.Add(base._owner.rotateToAvatarFacingState); }
private void MoveMode() { // デバック機能使用中はそちらを優先する if (_debug && _debugObj != null) { // モードを強制的に変更する if (_mode == FollowMode.NON) { _mode = FollowMode.MOVE; } switch (_mode) { case FollowMode.MOVE: transform.position = Vector3.Lerp(transform.position, _debugObj.transform.position, Time.deltaTime * _speed); break; case FollowMode.WARP: transform.position = _debugObj.transform.position; break; case FollowMode.NON: default: break; } return; } // ターゲットがなければ強制的にモードを戻す if (_target == null) { _mode = FollowMode.NON; } // モードに合わせて移動を開始する switch (_mode) { case FollowMode.NON: // ターゲットの参照リセット _target = null; transform.localPosition = Vector3.Lerp(transform.localPosition, _localPos, Time.deltaTime * _speed); break; case FollowMode.MOVE: transform.position = Vector3.Lerp(transform.position, _target.transform.position, Time.deltaTime * _speed); break; case FollowMode.WARP: transform.position = _target.transform.position; break; default: break; } }
// Use this for initialization void Start() { cat = GameManager.Instance.Player; boy = transform.GetComponent <BoyController>(); dangerDct = transform.GetComponent <DangerDetector>(); jmpDct = transform.Find("JumpDetector").GetComponent <JumpDetector>(); followNav = new FollowNav(boy, nav); followDirect = new FollowDirect(boy); GameManager.Instance.AddRoleListener(this); //初始化 mode = FollowMode.FollowTarget; targetTransfrom = cat.transform; }
protected virtual void Dispose(bool disposing) { if (Disposed) { return; } if (disposing) { Renderer.Dispose(); UpdateMode.Dispose(); FollowMode.Dispose(); Mode.Dispose(); Factory.Dispose(); } Disposed = true; }
public Camera(FollowMode followMode, HasLocation target) { this.followMode = followMode; setTarget(target); }
public Camera(FollowMode followMode) { this.followMode = followMode; }
//跟随目标 public void FollowTarget(GameObject target) { arrived = false; mode = FollowMode.FollowTarget; targetTransfrom = target.transform; }
public void SetParam(float dis, Vector3 offset_pos, FollowMode m = FollowMode.All) { distance = dis; mode = m; offset = offset_pos; }
// Start is called before the first frame update void Start() { _mode = FollowMode.NON; _target = null; _localPos = transform.localPosition; }
public void SetFollowMode(FollowMode mode) { followMode = mode; }
public void ChangeFollowMode() { this.followMode = (this.followMode == FollowMode.smooth) ? FollowMode.firm : FollowMode.smooth; }
//走到指定点 public void GotoPoint(Vector3 point) { arrived = false; mode = FollowMode.FollowPoint; targetPoint = point; }