public Command GetCommand(CommandPrefab commandPrefab) { foreach (Command command in innactiveCommands) { if (command.GetType() == commandPrefab.Prefab.GetType()) { unpool(command); return(command); } } Command newCommand = InstantiateCommand(commandPrefab); activeCommands.Add(newCommand); return(newCommand); }
private Command InstantiateCommand(CommandPrefab commandPrefab) { return(Instantiate <Command>(commandPrefab.Prefab, Vector3.zero, Quaternion.identity, transform)); }