public CellGridStateTarget(CellGrid cellGrid, Unit unit, eTargetType type, Predicate <Unit> unitPredicate, Action <Unit> unitAction) : base(cellGrid) { _unit = unit; _type = type; _pathsInRange = new List <Cell>(); _unitsInRange = new List <Unit>(); _unitPredicate = unitPredicate; _unitAction = unitAction; }
public CellGridStateTarget(CellGrid cellGrid, Unit unit, eTargetType type, Func <List <Cell>, List <Cell> > cellFilter, Action <Cell> cellAction) : base(cellGrid) { _unit = unit; _type = type; _pathsInRange = new List <Cell>(); _unitsInRange = new List <Unit>(); _cellFilter = cellFilter; _cellAction = cellAction; }
public void setTarget(eTargetType target) { if (characterController != null) { switch (target) { case eTargetType.WAYPOINT: characterController.SetTarget(waypoint[waypointCounter].transform); break; case eTargetType.PLAYER: characterController.SetTarget(player.transform); break; } } }
// METHODS //------------------------------------------------------------------------- protected LinkTask (eTargetType tgtType) { mTargetType = tgtType; }
public void OnGUI() { EditorGUILayout.LabelField("标记索引", FlagIndex.ToString()); TargetType = (eTargetType)EditorGUILayout.EnumPopup("目标类型", TargetType); AutoDestroy = EditorGUILayout.Toggle("是否自动销毁", AutoDestroy); DummyPoint = (eAvatarType)EditorGUILayout.EnumPopup("骨骼点", DummyPoint); EditorGUILayout.BeginHorizontal(); EffectPrefab = EditorGUILayout.TextField("特效预设路径", EffectPrefab); if (GUILayout.Button(".", GUILayout.Width(20))) { string strPath = "Resources/"; string strVal = EditorUtility.OpenFilePanel("打开特效预设", Application.dataPath + "/Resources", "prefab"); int iPos = strVal.LastIndexOf(strPath); int toPos = strVal.LastIndexOf("."); if (iPos != -1 && toPos != -1) { EffectPrefab = strVal.Substring(iPos + strPath.Length, toPos - iPos - strPath.Length); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EffectType = (eEffectType)EditorGUILayout.EnumPopup("特效类型", EffectType); Scale = EditorGUILayout.FloatField("特效缩放", Scale); ScaleApplyModel = EditorGUILayout.Toggle("特效是否随模型缩放比", ScaleApplyModel); OffsetPos = EditorGUILayout.Vector3Field("特效位置偏移", OffsetPos); OffsetRotate = EditorGUILayout.Vector3Field("特效旋转偏移", OffsetRotate); DelayDestroyTime = EditorGUILayout.FloatField("延迟销毁", DelayDestroyTime); if (EffectType == eEffectType.Bullet || EffectType == eEffectType.Trace) { Speed = EditorGUILayout.FloatField("速度", Speed); } if (EffectType == eEffectType.Attach) { OnlyTranslate = EditorGUILayout.Toggle("attach特效是否只位置改变", OnlyTranslate); } RotateToAttacker = EditorGUILayout.Toggle("是否朝向释放者", RotateToAttacker); if (EffectType == eEffectType.Bullet) { LifeTime = EditorGUILayout.FloatField("子弹生命时间", LifeTime); } if (EffectType == eEffectType.Bullet || EffectType == eEffectType.Trace) { EditorGUILayout.BeginHorizontal(); ArrivedInstance = EditorGUILayout.TextField("击中目标实例预设", ArrivedInstance); if (GUILayout.Button(".", GUILayout.Width(20))) { string strPath = "Resources/"; string strVal = EditorUtility.OpenFilePanel("打开击中目标实例预设", Application.dataPath + "/Resources", "prefab"); int iPos = strVal.LastIndexOf(strPath); int toPos = strVal.LastIndexOf("."); if (iPos != -1 && toPos != -1) { ArrivedInstance = strVal.Substring(iPos + strPath.Length, toPos - iPos - strPath.Length); } } EditorGUILayout.EndHorizontal(); } if (EffectType == eEffectType.Trace) { TraceType = (eTraceType)EditorGUILayout.EnumPopup("追踪特效类型", TraceType); TraceDummyPoint = (eAvatarType)EditorGUILayout.EnumPopup("追踪特效打击骨骼点", TraceDummyPoint); TraceOffsetLen = EditorGUILayout.FloatField("抛物线偏移距离", TraceOffsetLen); TraceOffsetAngle = EditorGUILayout.FloatField("抛物线偏移角度", TraceOffsetAngle); FactorVal = EditorGUILayout.FloatField("抛物线计算因子", FactorVal); TraceOffsetStandDis = EditorGUILayout.FloatField("抛物线参考距离", TraceOffsetStandDis); } if (EffectType == eEffectType.Bullet) { BulletACross = EditorGUILayout.Toggle("子弹是否穿越", BulletACross); BulletDamageWidth = EditorGUILayout.FloatField("子弹穿越伤害宽度", BulletDamageWidth); } if (EffectType == eEffectType.Boomerang) { // Target = GlobalData.TargetType.TargetType_None; Speed = EditorGUILayout.FloatField("速度", Speed); OnceTime = EditorGUILayout.FloatField("抵达折返点时间", OnceTime); BackToAttaker = EditorGUILayout.Toggle("返回到角色", BackToAttaker); BooDamageWidth = EditorGUILayout.FloatField("回旋镖穿越伤害宽度", BooDamageWidth); } if (EffectType == eEffectType.Bounce) { Speed = EditorGUILayout.FloatField("速度", Speed); BounceTimes = EditorGUILayout.IntField("最大弹跳次数", BounceTimes); BounceDistance = EditorGUILayout.FloatField("最大弹跳距离", BounceDistance); } if (EffectType == eEffectType.Thunder) { Speed = EditorGUILayout.FloatField("速度", Speed); TraceDummyPoint = (eAvatarType)EditorGUILayout.EnumPopup("链接目标骨骼点", TraceDummyPoint); EditorGUILayout.BeginHorizontal(); ThunderPrefab = EditorGUILayout.TextField("链条特效预设路径", ThunderPrefab); if (GUILayout.Button(".", GUILayout.Width(20))) { string strPath = "Resources/"; string strVal = EditorUtility.OpenFilePanel("打开特效预设", Application.dataPath + "/Resources", "prefab"); int iPos = strVal.LastIndexOf(strPath); int toPos = strVal.LastIndexOf("."); if (iPos != -1 && toPos != -1) { ThunderPrefab = strVal.Substring(iPos + strPath.Length, toPos - iPos - strPath.Length); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } if (EffectType == eEffectType.Laser) { LaserMaxLength = EditorGUILayout.FloatField("激光束最大长度", LaserMaxLength); LaserStartWidth = EditorGUILayout.FloatField("激光束开始宽度", LaserStartWidth); LaserEndWidth = EditorGUILayout.FloatField("激光束结束宽度", LaserEndWidth); LaserCalcDamageTime = EditorGUILayout.FloatField("激光束计算伤害时间间隔", LaserCalcDamageTime); EditorGUILayout.BeginHorizontal(); LaserHeadEffect = EditorGUILayout.TextField("激光头特效", LaserHeadEffect); if (GUILayout.Button(".", GUILayout.Width(20))) { string strPath = "Resources/"; string strVal = EditorUtility.OpenFilePanel("打开特效预设", Application.dataPath + "/Resources", "prefab"); int iPos = strVal.LastIndexOf(strPath); int toPos = strVal.LastIndexOf("."); if (iPos != -1 && toPos != -1) { LaserHeadEffect = strVal.Substring(iPos + strPath.Length, toPos - iPos - strPath.Length); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); LaserTailEffect = EditorGUILayout.TextField("激光尾特效", LaserTailEffect); if (GUILayout.Button(".", GUILayout.Width(20))) { string strPath = "Resources/"; string strVal = EditorUtility.OpenFilePanel("打开特效预设", Application.dataPath + "/Resources", "prefab"); int iPos = strVal.LastIndexOf(strPath); int toPos = strVal.LastIndexOf("."); if (iPos != -1 && toPos != -1) { LaserTailEffect = strVal.Substring(iPos + strPath.Length, toPos - iPos - strPath.Length); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); }
// METHODS //------------------------------------------------------------------------- protected LinkTask(eTargetType tgtType) { mTargetType = tgtType; }
public bool RenderObjectProperties(GUIContent label) { bool dataChanged = false; _gameObject = SerializationEditorGUILayout.ObjectField(_gameObject, "Game Object", ref dataChanged); _transformFlags = SerializationEditorGUILayout.ObjectField(_transformFlags, "Transform Flags", ref dataChanged); _moveType = SerializationEditorGUILayout.ObjectField(_moveType, "Move Type", ref dataChanged); _easeType = SerializationEditorGUILayout.ObjectField(_easeType, "Ease Type", ref dataChanged); EditorGUI.BeginChangeCheck(); _duration = EditorGUILayout.FloatField("Duration", _duration); dataChanged |= EditorGUI.EndChangeCheck(); bool targetChanged = false; _targetType = SerializationEditorGUILayout.ObjectField(_targetType, "Target Type", ref targetChanged); if (targetChanged) { dataChanged = true; _targetTransform = new GameObjectRef(); _targetPosition = Vector3.zero; _targetRotation = Quaternion.identity; _targetScale = Vector3.one; } switch (_targetType) { case eTargetType.Transform: { _targetTransform = SerializationEditorGUILayout.ObjectField(_targetTransform, new GUIContent("Target Type"), ref dataChanged); } break; case eTargetType.LocalDelta: case eTargetType.LocalTarget: case eTargetType.WorldDelta: case eTargetType.WorldTarget: { if ((_transformFlags & eTransformFlag.Translate) != 0) { EditorGUI.BeginChangeCheck(); _targetPosition = EditorGUILayout.Vector3Field("Translation", _targetPosition); dataChanged |= EditorGUI.EndChangeCheck(); } if ((_transformFlags & eTransformFlag.Rotate) != 0) { EditorGUI.BeginChangeCheck(); _targetRotation.eulerAngles = EditorGUILayout.Vector3Field("Rotation", _targetRotation.eulerAngles); dataChanged |= EditorGUI.EndChangeCheck(); } if ((_transformFlags & eTransformFlag.Scale) != 0) { EditorGUI.BeginChangeCheck(); _targetScale = EditorGUILayout.Vector3Field("Scale", _targetScale); dataChanged |= EditorGUI.EndChangeCheck(); } } break; } return(dataChanged); }