public void Launch_FileItem() { Launchable launchable = _actionRegistry.Launch(new IIndexable[] { new FileItem(Assembly.GetExecutingAssembly().Location) }); launchable.Action.ShouldBeType <OpenAction>(); launchable.Target.ShouldBeType <FileItem>(); }
void Launch() { if (ToLaunch == null) { return; } GameObject obj = Instantiate <GameObject>(ToLaunch); obj.transform.SetParent(transform); RectTransform rect = obj.GetComponent <RectTransform>(); if (rect) { rect.anchoredPosition = StartAnchoredPosition; float startRot = StartRotation; rect.localRotation = rect.localRotation * Quaternion.AngleAxis(startRot, Vector3.forward); } obj.transform.SetParent(transform.parent, true); transform.SetAsLastSibling(); Launchable launch = obj.GetComponent <Launchable>(); float launchRot = Random.Range(MinLaunchRotation, MaxLaunchRotation); launchRot *= Mathf.Deg2Rad; Vector2 direction = new Vector2(Mathf.Cos(launchRot), Mathf.Sin(launchRot)); float speed = Random.Range(MinLaunchSpeed, MaxLaunchSpeed); launch.Velocity = direction * speed; launch.Gravity = Random.Range(MinGravity, MaxGravity); launch.RotationSpeed = Random.Range(MinRotationSpeed, MaxRotationSpeed); }
public void Add(string input, Launchable launchable) { if (!launchable.ShouldStoreHistory) return; if (File.Null.Equals(launchable)) return; dictionary[input.ToLower()] = launchable; StoreHistory(); }
public void Launch_FileItem_ContainingFolder() { Launchable launchable = _actionRegistry.Launch(new IIndexable[] { new FileItem(Assembly.GetExecutingAssembly().Location), new ContainingFolderConverter() }); launchable.Action.ShouldBeType <OpenAction>(); launchable.Target.ShouldBeType <FolderItem>(); }
public void Start() { m_aim = GetComponent <PlayerAim>(); m_motor = GetComponent <PlayerMotor>(); m_motion = GetComponent <MotionBuffer>(); m_launchable = GetComponent <Launchable>(); }
public void Start() { m_motor = GetComponent <PlayerMotor>(); m_launchable = GetComponent <Launchable>(); m_aim = GetComponent <PlayerAim>(); m_skillController = GetComponent <PlayerSkillController>(); }
public LaunchableInformationViewModel(Launchable selectedLaunchable) { SelectedLaunchable = selectedLaunchable; if (selectedLaunchable != null) { Console.WriteLine(selectedLaunchable.Name); } }
public void Launch(Launchable command, string[] args) { if (!(command is Command)) { throw new ArgumentOutOfRangeException( string.Format("Launchable should be of type command, got '{0}' instead.", command.GetType())); } RunCommand( CreateCommand(args, command as Command)); }
public void Start() { QuickBoltPrefab.CreatePool(10); StunBoltPrefab.CreatePool(2); m_motor = GetComponent <PlayerMotor>(); m_motion = GetComponent <MotionBuffer>(); m_aim = GetComponent <PlayerAim>(); m_launchable = GetComponent <Launchable>(); Debug.Log("BoltSkill Awoken"); }
public void Launch(Launchable command, string[] args) { var commander = (Commander)command; var instance = Activator.CreateInstance(commander.Type); var map = new Dictionary <string, int>(); var prms = commander.Method.GetParameters().ToList(); var data = new object[prms.Count]; var idx = 0; foreach (var param in prms) { map.Add(param.Name, idx++); } var regexp = new Regex(ParameterPattern, RegexOptions.IgnoreCase | RegexOptions.Singleline); var groupCollections = args .Where(p => regexp.IsMatch(p)) .Select(p => regexp.Matches(p)) .Where(m => m.Count == 1) .Where(m => m[0].Groups.Count == 3) .Select(m => m[0].Groups); var cmp = StringComparer.OrdinalIgnoreCase; foreach (var groups in groupCollections) { const int parameter = 1; const int value = 2; var p = groups[parameter].Value; var v = groups[value].Value; // todo if (commander.HasAlias(p)) { var param = commander.GetAlias(p); var pidx = map[param.Name]; data[pidx] = ConverterFactory.GetConverter(param.ParameterType).GetValue(v); } } commander.Method.Invoke(instance, data); }
private void InstantiateItem(Launchable launchable) { Vector3 spawnPosition = new Vector3(Random.Range(-launchable.LaunchPoint.x, launchable.LaunchPoint.x), launchable.LaunchPoint.y, launchable.LaunchPoint.z); Quaternion spawnRotation = Quaternion.identity; switch (launchable.LaunchType) { case LaunchType.Coin: Instantiate(coin, spawnPosition, spawnRotation); break; case LaunchType.Bomb: Instantiate(bomb, spawnPosition, spawnRotation); break; default: Debug.Log("Type not available, defaulting to coin."); Instantiate(coin, spawnPosition, spawnRotation); break; } }
public void AppLaunched(string input, Launchable file) { new Thread(() => history.Add(input, file)).Start(); }
public IEnumerable<FileSystem.Action> ActionsFor(Launchable launchable) { return ActionsFor(((File) launchable).FileSystemInfo); }
public bool Handles(Launchable launchable) { return launchable.GetType() == typeof (File); }
public ExecutedCommand(Launchable launchable, FileSystem.Action action) : this() { this.launchable = launchable; this.action = action; }
public ExecutedCommand(Launchable launchable, string arguments) : this() { this.launchable = launchable; this.arguments = arguments; }
// Use this for initialization public void Awake() { m_launchable = GetComponent <Launchable>(); m_startPos = transform.position; }
public bool CanLaunch(Launchable command) { return(false); }
public bool Contains(Launchable file) { return dictionary.ContainsValue(file); }
public bool ContainsAsSubstring(string input, Launchable file) { foreach (var pair in dictionary) if (pair.Value.Equals(file) && pair.Key.Contains(input.ToLower())) return true; return false; }
// Use this for initialization void Start() { MainTerrain = GameObject.Find("Main Camera").GetComponent<CameraMove>().MainTerrain; MyLaunchable = gameObject.GetComponent<Launchable>(); MyTetherDropper = gameObject.GetComponent<TetherDropper>(); }
public void Launch(Launchable command, string[] args) { throw new NotSupportedException("Cannot launch commands!"); }
public void AddExecutedCommand(Launchable launchable, FileSystem.Action action) { if (typeof (ExecutedCommand).IsAssignableFrom(action.GetType())) AddExecutedCommand((ExecutedCommand) action); else AddExecutedCommand(new ExecutedCommand(launchable, action)); }
public void AddExecutedCommand(Launchable launchable, string arguments) { if (!typeof (Recent).IsAssignableFrom(launchable.GetType())) AddExecutedCommand(new ExecutedCommand(launchable, arguments)); }
// Use this for initialization void Start() { StartCoroutine(LaunchMe()); TargetLaunchable = Target.GetComponent<Launchable>(); }
public bool CanLaunch(Launchable command) { return(command is Commander); }
public bool IsExactMatch(string input, Launchable file) { Launchable historicalFile; return dictionary.TryGetValue(input.ToLower(), out historicalFile) && file.Equals(historicalFile); }
private static new ImageSource Icon(Launchable launchable) { try { return launchable.Icon; } catch (Exception exception) { LogManager.WriteLog(exception); return new BitmapImage(); } }
public void AddNewLaunchable(string path) { Launchable newLaunchable = new Launchable(path); Launchables.Add(newLaunchable); }